Is there a problem with the concept of "array joins using concat ()" on the official website?

This is how concat (): joins two or more arrays as defined on
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.
Mar.28,2021

the real js official website, which is clearly written:
http://www.ecma-international.


js is a less rigorous language. W3C says the original meaning of concat, but it has been extended and extended in its implementation, so that concat can accept not only arrays but also non-arrays.

there are many examples of this in js. For example, parseInt can accept strings or other types of parameters. According to the intention of this function, you can only accept strings. For example, js can allow non-executable code as a statement, such as a string as a statement. (did you immediately think of use strict ? This is not allowed in many languages


The original purpose of

concat definition is to concatenate two or more arrays. Of course, it is not just a splicing array, but you can understand that it splices multiple elements into an array. If its parameter is an array, then break up the array in the parameters and concatenate it into the new array in the form of a single element

.
[].concat([1,[2]],[3]); //[1, [2], 3]

< del > in addition to concatenating arrays, concat can also concatenate strings ''.concat (1mem2, [3recover4]); / / "123 code 4" < / del >


can you read the document carefully? no, no, no.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3335f-2be5b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3335f-2be5b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?