add to an array and delete item of the array javascript code example
Example 1: js remove item array
let originalArray = [1, 2, 3, 4, 5];
let filteredArray = originalArray.filter((value, index) => index !== 2);
Example 2: remove element from array javascript
let values = [1,2,3,4,5,7,8,9,10]
// only keep n values from an array
values.length = 5