It looks like you could get better perf (at least for long arrays) using Array#concat without the spread operator:
Array#concat
jsperf.com/concat-vs-spreader
Also remember that Array#push returns the pushed item new length of the array, not the array 😉
Array#push
You're right, should have a , array at the end I guess or a separate line
, array
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It looks like you could get better perf (at least for long arrays) using
Array#concat
without the spread operator:jsperf.com/concat-vs-spreader
Also remember that
Array#push
returns thepushed itemnew length of the array, not the array 😉You're right, should have a
, array
at the end I guess or a separate line