Array.prototype.distinct = function () { ret = []; for (i = 0; i < this.length;i++ ) { ret.indexOf(this[i]) > -1 ? 1 : ret.push(this[i]); } return ret; } 说明:向数组的原型添加distinct,则所有数组皆可共享此方法。