问题
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?
回答1:
[].concat is Array.prototype.concat.
Array.concat is a Firefox-only static method that concatenates one or more arrays and ignores its this argument.
来源:https://stackoverflow.com/questions/8669527/apply-function-in-javascript