Tech Dropbox
Pages
Home
About yitz..
About this blog..
22.10.09
Javascript array manipulation : splice
use the splice function to remove (an) element(s) from anwywhere in a javascript array without leaving an undefined cell in the middle.
don't forget indexOf for finding elements in the array to delete :)
var idx = mylist.indexOf(elementToDelete)
mylist.splice(idx,idx);
//now it's gone.
for good examples and explanation click here
.
No comments:
Post a Comment
Newer Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment