Skip to content

Instantly share code, notes, and snippets.

@fedir
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/995a590538acafe390ff to your computer and use it in GitHub Desktop.
Save fedir/995a590538acafe390ff to your computer and use it in GitHub Desktop.
Remove an object from an array based on it's property
// ref .: http://stackoverflow.com/questions/15287865/remove-array-element-based-on-object-property
myArray = myArray.filter(function( obj ) {
return obj.field !== 'money';
});
// ref .: http://stackoverflow.com/questions/15287865/remove-array-element-based-on-object-property
for( i=myArray.length-1; i>=0; i--) {
if( myArray[i].field == "money") myArray.splice(i,1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment