SyntaxFix
Write A Post
Hire A Developer
Questions
When using most functions of objects with apply or call, the context parameter MUST be the object you are working on.
apply
call
context
In this case, you need a.push.apply(a, [1,2]) (or more correctly Array.prototype.push.apply(a, [1,2]))
a.push.apply(a, [1,2])
Array.prototype.push.apply(a, [1,2])