|
These functions do different things though, right? push() mutates an array in-place, and concat() completely duplicates the existing array and adds another array to it. > x=[]; x.push(...[1,2]); console.log(x);
[1, 2]
> x=[]; x.concat([1]); console.log(x);
[]
So clearly push should be faster in general in usecases like these, since it does not need to copy.Edit: grammar and copy paste failures from my console |