Delete Elements From Array Javascript
Maybe by title seems a easy question, but I didn´t know how to do the shortest title for my question. I want to delete elements from array on javascript, yes, but what I am lookin
Solution 1:
var C = [];
for(var i = 0; i < B.length; i ++){
if(A.indexOf(B[i]) > -1){
C.push(B[i]);
}
}
What this does is
- Creates array
C
- Runs through each item in
B
if
B[i]
is inA
, add it toC
Post a Comment for "Delete Elements From Array Javascript"