remove element by reference javascript code example
Example 1: remove element from array javascript
//using filter() method => it returns a new array
data = [1, 2, 3, 4, 5, 6];
let filteredData = data.filter((i) => {
return i > 2
});
console.log(filteredData) // [3, 4, 5, 6]
Example 2: remove object from array javascript
someArray.splice(x, 1);