I constantly have problem with keeping this in my head, and I can't google it out quickly. That's why I'm putting this question here.
Every time I'm calling a method like concat
, sort
or slice
, I'm asking myself: does it create and return a new array, or it just modifies and returns array it was applied to?
Q: could you please list methods that change the original array vs methods that construct and return a new array?
Methods like pop
or push
are not in the game, it's obvious what they do.