Why is Array.prototype.push faster than variable declaration

Viewed 68

I ran the following jsperf https://jsperf.com/push-vs-define-anaoum

and found out that push in this case :

var a = [];
a.push([1,2,3]);
a.push(["a","b","c"]);

is faster than just declaring a with the subarrays inside :

var a = [
  [1,2,3],
  ["a","b","c"]
];

Could anyone please tell me why or point me in the right documentation?

Thanks enter image description here

1 Answers
Related