A way to change array in javascript back to previous values code example
Example 1: forEach modify array JavaScript
arr.forEach(function(part, index) {
this[index] = "hello world";
}, arr); // use arr as this
Example 2: modify array js
let newArray = oldArray.map(funcToEachElem);