Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove an object from javascript array

let toRemove = {	
  id:1,
  first_name : "Marty",
  last_name : "Mcfly",
  } 
for (let i = 0; i < array.length; i++) {
  if (array[i].id === toRemove.id) {
    accountTemp.splice(i, 1);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #object #javascript #array
ADD COMMENT
Topic
Name
9+1 =