Tránh viết biến có phạm vi global
tipjs,scope,global
Không nên
var map = document.querySelector("#my-map");
map.style.height = "600px";
Nên
!function(){
var map = document.querySelector("#my-map");
map.style.height = "600px";
}()Có thể bạn đã miss một số snippets code
So sánh hai array trong javascript
Làm thế nào để đánh giá xem hai mảng có bằng nhau không? Có hai cách đó là sử dụng JSON.stringify() hoặc toString()
kiểm tra email trong javascript
kiểm tra email trong javascript
Getting the last element of a split string array
Getting the last element of a split string array
Detect when your site is visible to users
Detect when your site is visible to users
Converting Object to an Array
Converting Object to an Array