【JS】数组中删除指定某个值

Array.prototype.removeByValue = function(val) {  
 for(var i=0; i<this.length; i++) {  
    if(this[i] == val) {     
         this.splice(i, 1);  
         break;  
    }  
 } 
} 

 

posted @ 2017-08-23 09:36  丰study  阅读(649)  评论(0)    收藏  举报