Why doesn't Array.push.apply work?
It's Array.prototype.push
, not Array.push
You can also use [].push.apply(a, b)
for shorter notation.
The current version of JS allows you to unpack an array into the arguments.
var a = [1, 2, 3, 4, 5,];
var b = [6, 7, 8, 9];
a.push(...b); //[1, 2, 3, 4, 5, 6, 7, 8, 9];