javascript foreach change value 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