Posted By

myke on 10/09/10


Tagged

array remove


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bobbym245


Javascript remove item from array


 / Published in: JavaScript
 

Simply pass in array name and the value of the item you want to remove

  1. function removeByElement(arrayName,arrayElement)
  2. {
  3. for(var i=0; i<arrayName.length;i++ )
  4. {
  5. if(arrayName[i]==arrayElement)
  6. arrayName.splice(i,1);
  7. }
  8. }

Report this snippet  

You need to login to post a comment.