delete a variable in an array javascript code example
Example 1: how to remove item from array javascript
var array = ["Item", "Item", "Delete me!", "Item"]
array.splice(2,1) // array is now ["Item","Item","Item"]
Example 2: how to delete element in array in javascript
let value = 3
let arr = [1, 2, 3, 4, 5, 3]
arr = arr.filter(item => item !== value)
console.log(arr)
// [ 1, 2, 4, 5 ]