I'm learning JavaScript and I'm currently trying to figure out why (in Spidermonkey)
[].concat.apply([1], [[2]])
returns the expected [1, 2]
, but
Array.concat.apply([1], [[2]])
returns [2]
instead of [1, 2]
.
Could someone provide a good explanation?
[].concat
isArray.prototype.concat
.Array.concat
is a Firefox-only static method that concatenates one or more arrays and ignores itsthis
argument.