array delete key javascript code example
Example 1: js delete object in dict
delete myArray[id_to_remove];
Example 2: remove element from javascript array
const array = [2, 5, 9];
console.log(array);
const index = array.indexOf(5);
if (index > -1) {
array.splice(index, 1);
}
// array = [2, 9]
console.log(array);
Example 3: how to delete object property of array javascript
array.forEach(function(v){ delete v.bad });