I want to replace a string within an array with another string.
In my example cat
should be replaced with mouse
:
var arr1 = [ "dog", "cat"];
for(i=0; i<arr1.length; i++){
arr1[i].replace("cat", "mouse");
}
Unfortunately, the array remains unchanged.
Where is the error?