标签:js
var myArr=[1,2,1,2,2,3,3,4,4,5,5,6,6]; function myRemove(){ this.sort(); for(i=0;i<this.length;i++){ for(j=0;j<this.length-i;j++){ if(this[j]==this[j+1]){ this.splice(j+1,1); } } } return this; } Array.prototype.myRemove=myRemove; alert(myArr.myRemove());
标签:js
原文地址:http://11272569.blog.51cto.com/11262569/1747115