Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

array splice

var arrayElements = [1,2,3,4,2];

console.log(arrayElements);

//[1, 2, 3, 4, 2] 

arrayElements.forEach((element,index)=>{
   if(element==2) arrayElements.splice(index,1);
});

console.log(arrayElements);

//[1, 3, 4]
Source by www.angularjswiki.com #
 
PREVIOUS NEXT
Tagged: #array #splice
ADD COMMENT
Topic
Name
4+5 =