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
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.
10 mẹo sử dụng array và object trong javascript
10 mẹo sử dụng array và object trong javascript
Remove item in array javascript es6
Những bạn nào mà đã sử dụng ES6 một thời gian rồi thì có thể sử dụng method array.filter()
Sử dụng reduce và concat làm phẳng một array
Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như:
Merge Array
How to combine two sorted arrays into one? We can do this easily with the spread operator.