Array.prototype.contains = function (elem) {   
 for (var i = 0; i < this.length; i++) {       
      if (this[i] == elem) {              
       return true;           
     }      
   }     
  return false; 
 }

 
Array.prototype.indexOf = function(o){   

    for(var i = 0 ;  i<this.length;i++){

           if(this[i] == o){

                            return i;

           }           return -1;     } };

 

 

Array.prototype.delete = function(o){

   var index = this.indexOf(o);

           if(index != -1){

                 this.splice(index,1)

             }

           return this;

}

 

posted on 2014-01-20 18:18  dancser  阅读(1260)  评论(0编辑  收藏  举报