javascript 剔除数组中相同的值,合并数组中相同项

var a = ["2013-01","2013-01","2013-02","2013-02","2013-02","2013-03","2013-03"];
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(a.del());

原文地址:https://www.cnblogs.com/smght/p/5364754.html