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

Getting the last element of a split string array

Getting the last element of a split string array

Promise + gì

promise + gì

Copy a string to the clipboard

Copy a string to the clipboard. Only works as a result of user action (i.e. inside a click event listener).

Extend Object javascript

Extend Object javascript

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.