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

closure javascript

closure javascript

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

group by property javascript use reduce

group by property javascript use reduce

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.

Extend Object javascript

Extend Object javascript