var a = [5,4,3,2,1,2,3,2,1,];
Array.prototype.duplicate=function() {
var tmp = [];
this.concat()().sort().sort(function(a,b){
if(a==b && tmp.indexOf(a) === -1) tmp.push(a);
});
return tmp.length;
}
document.write(a.duplicate())
return 里写tmp可以返回重复的元素是哪个 有.length是返回重复了多少个