Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove multiple elements from array es6

const colors=["red","green","blue","yellow"];
let index = colors.length - 1;
while (index >= 0) {
  	if (['green', 'blue'].indexOf(colors[index]) > (-1)) {
    	colors.splice(index, 1);
  	}
  	index -= 1;
}
 
PREVIOUS NEXT
Tagged: #remove #multiple #elements #array
ADD COMMENT
Topic
Name
9+2 =