reassign array values with for each code example
Example 1: foreach and replace item based on condition
arr.forEach(function(part, index) {
this[index] = "hello world";
}, arr); // use arr as this
Example 2: js array modify element
people[0] = "Georgie";