I wanted to concat two arrays in JavaScript so I wanted to know if the ES6 spread operator ...
is costlier than array.concat
?
Does that mean we should use the ...
syntax wisely and only when utmost needed?
I wanted to concat two arrays in JavaScript so I wanted to know if the ES6 spread operator ...
is costlier than array.concat
?
Does that mean we should use the ...
syntax wisely and only when utmost needed?
let arrayVar = [1, 2, 3];
let array2 = [...arrayVar, 4];
is equivalent to
var arrayVar = [1, 2, 3];
var array2 = [].concat(arrayVar, [4]);