Заменить элемент массива JavaScript
// Replace 1 array element at index with item
arr.splice(index,1,item);
Kaotik
// Replace 1 array element at index with item
arr.splice(index,1,item);
array.splice(array.indexOf(valueToReplace), 1, newValue);
String.prototype.replaceArray = function(find, replace) {
var replaceString = this;
for (var i = 0; i < find.length; i++) {
replaceString = replaceString.replace(find[i], replace[i]);
}
return replaceString;
};