DEV Community

Discussion on: Is JavaScript's .shift() Method a Performance Boost?

lionelrowe profile image
lionel-rowe • Edited on

It looks like you could get better perf (at least for long arrays) using Array#concat without the spread operator:

Also remember that Array#push returns the pushed item new length of the array, not the array 😉

miketalbot profile image
Mike Talbot

You're right, should have a , array at the end I guess or a separate line