jeudi 16 avril 2015

Deleting Element After Pushing

If I have an array where I am pushing certain elements to a second array- how can I delete those elements from the first array after pushing them to the second? Here is sample code:



for(var a = 0; a < arr.length; a+=1){
if(arr[a].length == 4){
other.push(arr[a]);

}
}


In other words, I know longer want elements arr[a] to be in arr if they have been pushed to other. This is going to mess up the length of arr (should I count backwards?)


Aucun commentaire:

Enregistrer un commentaire