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

Merge Array

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

Callback in javascript

Callback in 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.

Rest Operator for Objects

Now we can use rest on the properties of an Object. It allows us to explicitly extract certain named variables, and assign any uncalled variables into a catchall Object.

group by property javascript use reduce

group by property javascript use reduce