Javascript Array removeItem(item, all)

Description

Javascript Array removeItem(item, all)


Array.prototype.removeItem=function (item, all){
    var found;/* ww  w.  ja  v  a  2 s. co  m*/
    var pos = 0;
    do
    {
        pos = this.indexOf(item,pos)
        found = (pos != -1);
        if(found)
            this.splice(pos,1);
    }
    while(found && all);
}



PreviousNext

Related