Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

object delete with id filter javascript

const hero = [{'id' : 1, 'name' : 'hero1'}, {'id': 2, 'name' : 'hero2'}];
//remove hero1
const updatedHero = hero.filter(item => item.id !== 1);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #object #delete #id #filter #javascript
ADD COMMENT
Topic
Name
7+4 =