Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove array elements javascript

let forDeletion = [2, 3, 5]

let arr = [1, 2, 3, 4, 5, 3]

arr = arr.filter(item => !forDeletion.includes(item))
// !!! Read below about array.includes(...) support !!!

console.log(arr)
// [ 1, 4 ]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #array #elements #javascript
ADD COMMENT
Topic
Name
2+6 =