forEach change array or not js code example
Example: forEach modify array JavaScript
arr.forEach(function(part, index) {
this[index] = "hello world";
}, arr); // use arr as this
arr.forEach(function(part, index) {
this[index] = "hello world";
}, arr); // use arr as this