change values in array when doing foreach

example:

var arr = ["one","two","three"];

arr.forEach(function(part){
  part = "four";
  return "four";
})

alert(arr);

The array is still with it’s original values, is there any way to have writing access to array’s elements from iterating function ?

11 Answers
11

Leave a Comment