http://www.nowamagic.net/librarys/veda/detail/1487
http://bbs.chinaunix.net/thread-3650610-1-1.html
http://www.phpernote.com/php-function/516.html
1例子
//去除数组的重复值,使用方式:arr.del()
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;
}
使用例子:
var arr = new Array();
arr = [1,2,3,4,3,4,5,9,7,5,6];
alert(arr.del());
结果:1,2,3,4,5,6,7,9