Last active
April 26, 2018 12:29
-
-
Save heshamelmasry77/5f952c8ace4470e2f44cc78bc7e0489a to your computer and use it in GitHub Desktop.
deleting item from object in an array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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