1var myArr = [{id:'a'},{id:'myid'},{id:'c'}];
2var index = arr.findIndex(function(o){
3 return o.id === 'myid';
4})
5if (index !== -1) myArr.splice(index, 1);
1const array = [2, 5, 9];
2
3console.log(array);
4
5const index = array.indexOf(5);
6if (index > -1) {
7 array.splice(index, 1);
8}
9
10// array = [2, 9]
11console.log(array);
1const drinks = ['Cola', 'Lemonade', 'Coffee', 'Water'];
2const id = 2;
3const removedDrink = drinks.splice(id, 1);