DEV Community

loading...

Discussion on: JS Array Iterators Cheat Sheet — Part 1

Collapse
rkichenama profile image
Richard Kichenama

The third parameter sent to the callback for most of these functions is still a reference to the original array, not a copy. This means that while, during the callback, it is possible to mutate the original through array functions or assigning values.

Collapse
sarathsantoshdamaraju profile image
Krishna Damaraju Author • Edited

Yes, Richard, it does, but that is an optional callback passed by the developer and not a spec requirement. And one more important thing, using this callback might cause the unknown side-effects while mutating the original array.

But thanks for pointing, I have made some changes not to confuse readers.

Forem Open with the Forem app