W3C, and returns the result
We can do this:
var arr = [1,2,[3,4]]
[].concat(...arr) // [1,2,3,4]
but also has the following output:
console.log(...[1,2,[3,4]]) // 1 2 [3, 4]
this is obvious . The result of is not an array, so how can we directly use [] .concat (.arr) ?
-answer split line-
Let"s first look at a phenomenon:
[].concat(1,2) // [1,2]
[].concat(1,2,[3,4]) //[1,2,3,4]
:
When the concat method is called with zero or more arguments item1, item2, etc., it returns an array containing the array elements of the object followed by the array elements of each argument in order.