Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

delete all objects in array of objects with specific attribute

const arrayOfObjects = [{'objId' : 1, 'name' : 'objectA'}, {'objId': 2, 'name' : 'objectB'}];

// remove object with objId === 1 from the Array arrayOfObjects
const newArrayOfObjs = arrayOfObjects.filter(obj => obj.objId !== 1);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #objects #array #objects #specific #attribute
ADD COMMENT
Topic
Name
3+7 =