javascript determines whether the method in the array is repeated
- 2020-05-30 19:29:03
- OfStack
This example shows how javascript determines if an array is duplicated. Share with you for your reference. The details are as follows:
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;
}
I hope this article has been helpful to your javascript programming.