Array.prototype.remove = function(val){ var newArray = []; for(var i=0;i<this.length;i++){ if(this[i] != val){ newArray.push(this[i]) } } return newArray; }; var aaa = [1,1,1,1,2,2,43,5,65]; alert(aaa.remove(1))
Array.prototype.remove = function(val){ var newArray = []; for(var i=0;i<this.length;i++){ if(this[i] != val){ newArray.push(this[i]) } } return newArray; }; var aaa = [1,1,1,1,2,2,43,5,65]; alert(aaa.remove(1))
转载于:https://www.cnblogs.com/BobSky/p/3152304.html