1 // we have an array of objects, we want to remove one object using only the id property
2var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
3
4// get index of object with id:37
5var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
6
7// remove object
8apps.splice(removeIndex, 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
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}