Skip to content

Instantly share code, notes, and snippets.

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 heshamelmasry77/5f952c8ace4470e2f44cc78bc7e0489a to your computer and use it in GitHub Desktop.
Save heshamelmasry77/5f952c8ace4470e2f44cc78bc7e0489a to your computer and use it in GitHub Desktop.
deleting item from object in an array
// we have an array of objects, we want to find one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var wantedItem = apps.find(function(app) {
return app.id === 37;
});
//remove item
delete wantedItem.name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment