remove specific object from array of objects javascript code example
Example 1: how to remove a specific object from an array javascript
var arr = [{id:1,name:'serdar'}, {id:2,name:'alfalfa'},{id:3,name:'joe'}];
removeByAttr(arr, 'id', 1);
// [{id:2,name:'alfalfa'}, {id:3,name:'joe'}]
removeByAttr(arr, 'name', 'joe');
// [{id:2,name:'alfalfa'}]
Example 2: remove object from array javascript
someArray.splice(x, 1);
Example 3: javascript pop object from array
array.pop()