Array.prototype.del = function(){ var a = {}, c = [], l = this.length; for (var i = 0; i < l; i++){ var b = this[i]; var d = (typeof b) + b; if(a[d] === undefined){ c.push(b); a[d] = 1; } } return c; } //alert([1, 1, 2, 3, 4, 5, 4, 3, 4, 4, 5, 5, 6, 7].del());
原文地址:http://blog.csdn.net/tyleraxin/article/details/44411149