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);
1var id = 88;
2
3for(var i = 0; i < data.length; i++) {
4 if(data[i].id == id) {
5 data.splice(i, 1);
6 break;
7 }
8}
9
1//1
2someArray.shift(); // first element removed
3//2
4someArray = someArray.slice(1); // first element removed
5//3
6someArray.splice(0, 1); // first element removed
7//4
8someArray.pop(); // last element removed
9//5
10someArray = someArray.slice(0, a.length - 1); // last element removed
11//6
12someArray.length = someArray.length - 1; // last element removed
1var array = ['Object1', 'Object2'];
2
3// SIMPLE
4 array.pop(object); // REMOVES OBJECT FROM ARRAY (AT THE END)
5 // or
6 array.shift(object); // REMOVES OBJECT FROM ARRAY (AT THE START)
7
8// ADVANCED
9 array.splice(position, 1);
10 // REMOVES OBJECT FROM THE ARRAY (AT POSITION)
11
12 // Position values: 0=1st, 1=2nd, etc.
13 // The 1 says: "remove 1 object at position"