Drop It Javascript Intermediate Algorithm

I just completed the Drop It challenge easily enough. My code involved using slice, and I was surprised to see shift used in so many other solutions. Which left me wondering if there is an advantage to using shift over slice? I’m a very new learner, and I was under the impression it’s best practice to use a method that doesn’t alter the original array if possible. Is this correct? Does it only matter for more complex projects? I’m basically looking to understand best practices. Thanks for any help!

In general, yes, it is a best practice to avoid mutating inputs for a function unless the function explicitly is supposed to do so.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.