Arr[j]==i you seem to refer to the equality judgment when an array element is a number type ...
But often we may have to make equality judgments about different types of ... This is the practical application of the problem should be considered
Case of 1!=new number (1)
The situation of null==undefined
0== "0" situation and so on
So obviously simple = = and = = are not suitable.
A Equals method should be implemented independently to make equality judgments ... To set rules based on requirements
<script>
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 ([1, 1, 2, 3, 4, 5, 4, 3, 4, 4, 5, 5, 6, 7].del ());
</script>
Method Two
var arr = ["123", "123", "123", "123", "SFSDF", "123", "345", "123", "123", "345", "456", "567", "SDC"];
var str = [];
for (var i = 0,len = Arr.length;i < len;i++) {
! RegExp (Arr[i], "G"). Test (Str.join (",")) && (Str.push (arr[i));
}
alert (str);
Method Three
var x=[1,1,3,4,5,3];
var y=[];
var tarray=function (I,arr) {
var Yap=false;
for (Var j=0;j<arr.length;j++) {
if (arr[j]==i) {yap=true;break;};
}
if (!yap) Arr.push (i);
};
for (Var t=0;t<x.length;t++) {
Tarray (X[t],y);
}
alert (y.length);
Alert (y.tostring ());