4 ms·
I don't understand the need for the first example: Array.prototype.push.apply(a, b); Isn't that what the concat() method is for?
by Yansky 15y ago
I don't understand the need for the first example: Array.prototype.push.apply(a, b);
Isn't that what the concat() method is for?
- tomstuart 15y agoArray.prototype.push.apply(a, b) modifies a in-place; a.concat(b) returns a copy of a with b appended to it.