splice multiple javascript code example
Example 1: replace array element javascript
// Replace 1 array element at index with item
arr.splice(index,1,item);
Example 2: remove all mutliple items from array javascript
arr = [2, 2, 2, 1, 3, 3, 3,3, 4, 5];
arr = arr.sort().filter((item,i)=>!(arr[i] == arr[i+1] || arr[i-1]==arr[i]));
// this will remove all item which are repeating more then one
console.log(arr);
// [1, 4, 5]