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.
Sự khác biệt giữa substr và substring
Sự khác biệt giữa substr() và substring() chức năng trong JS là gì?
encode/decode base64 with JS
Encoding to base64 is done with the btoa command
try/catch es10
An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.
Đếm số phần tử trong mảng JavaScript
Đếm số lần xuất hiện của các phần tử trong mảng JavaScript