Finally, safe array methods in JavaScript

September 18, 2025

Laptop on an outdoor desk at sunset with a smartphone, pen holder, and writing utensils beside it.

There’s a good reason that many developers pause before using .sort(), .reverse(), or .splice() in JavaScript: those methods mutate the original array. That single side effect can lead to subtle, hard-to-trace bugs, especially in apps with shared or reactive state. The good news is that in the last couple of years we’ve gotten new array methods that make working with arrays safer and cleaner by avoiding mutation altogether:

Source: Finally, safe array methods in JavaScript – Matt Smith

We’ve covered some of the new JavaScript array functions more than once at presentations on Conffab. Here Matt Smith gives us an overview of these new methods.
Why do we need them? What advantages do they bring us? Well, they do not mutate the original array they operate on.