I like to choose a speedy option. That's why I benchmark™. As you can see, the spread operator looks nice, but is sometimes slow - even JSON.parse(JSON.stringify([])) is faster on Chrome! As a result, one can say that the spread operator is also slow on Node.JS. Personally, I like [].slice() a lot, and it is performant on all browsers (even older ones).
Tests performed on
on Windows 7 x64
I'm using the fifth (but similar to the first choice):
const myCopy = a.concat();
basically I will do anything that works ;D but I like the new syntax [...a] the sideeffects are the same, on a superficial level, most of them get the same result :) but maybe a js-guru can/will explain the differences based on OP-Code or something similar
Anand Kumar Parhi
a.slice() is the most performant one as I read long back in SO & everyone mentioned same here. I use that.