re: 5 Uses for the Spread Operator VIEW POST


I am using it in the React environment quite often and I'm curious if you have a clue about how the performance is compared to the equal methods like copying an array with spreading vs copying it via slice()?


It depends on the JS engine running, i.e. chrome vs safari. My understanding is that slice used to be more performant but that gap has been cut significantly and on many browsers, the spread operator is the same, or possibly better performance wise.

And since slice() only works for arrays, the spread operator is a more powerful piece of syntax.


Thanks for the answer, wasn't aware of it but a quick research confirmed it :)

Code of Conduct Report abuse