flatMap()

array,tipjs

Use flatMap() creates a new array with sub-array elements flattened by specified depth.

[[2], [4], [6], [8]].flatMap(val => val/2) // [ 1, 2, 3, 4 ]

var new_array = arr.flatMap(function callback(currentValue[, index[, array]]) {
 // return element for new_array
}[, thisArg])

Có thể bạn đã miss một số snippets code

Await in a for loop

How to Await in a for loop

encode/decode base64 with JS

Encoding to base64 is done with the btoa command

Lấy tháng hiện tại trong javascript

Lấy tháng hiện tại trong javascript

How to reverse an Array?

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

So sánh hai array trong javascript

Làm thế nào để đánh giá xem hai mảng có bằng nhau không? Có hai cách đó là sử dụng JSON.stringify() hoặc toString()