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

Getting the last element of a split string array

Getting the last element of a split string array

kiểm tra email trong javascript

kiểm tra email trong javascript

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.

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