Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Remove element from array

const apps = [
  {id:1, name:'test1'}, 
  {id:2, name:'test2'},
  {id:3, name:'test3'}
]
//remove item with id=2
const itemToBeRemoved = {id:2, name:'test2'}
apps.splice(apps.findIndex(a => a.id === itemToBeRemoved.id) , 1)
//print result
console.log(apps)
Source by love2dev.com #
 
PREVIOUS NEXT
Tagged: #Remove #element #array
ADD COMMENT
Topic
Name
7+8 =