remplacer l'élément de tableau 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);
var fruits = [“banana”, “apple”, “orange”, “watermelon”, “apple”, “orange”, “grape”, “apple”];
fruits.splice(0, 2, “potato”, “tomato”);
console.log(fruits); // returns [“potato”, “tomato”, “orange”, “watermelon”, “apple”, “orange”, “grape”, “apple”]