replace array element javascript
snippet in javascript

replace array element javascript

user4533

// Replace 1 array element at index with item 
arr.splice(index,1,item);

javascript replace array element

user923

array.splice(array.indexOf(valueToReplace), 1, newValue);