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
using javascript callback style error handling
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.
try/catch es10
An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.
encode/decode base64 with JS
Encoding to base64 is done with the btoa command
Converting Object to an Array
Converting Object to an Array