foreach and replace item based on condition
arr.forEach(function(part, index, theArray) {
theArray[index] = "hello world";
});
3.9
10
arr.forEach(function(part, index) {
this[index] = "hello world";
}, arr); // use arr as this
Thank you!
10
0
Are there any code examples left?
New code examples in category Javascript