js配列
]
メソッド2
コードは次のとおりです:
//配列の重複排除
関数unique(data){
data = data || [];
var a = {};
for (var i=0; ivar v = data[i];
if (typeof(a[v]) == '未定義'){
a[v] = 1;
}
};
data.length= 0;
for (var i in a){
data[data.length] = i;
}
方法 3
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 ){
! g").test(str.join( ",")) && (str.push(arr[i]));
}
alert(str);
メソッド4
var pureMulti1=function(arr){
var obj={};
var a = [];
for(var i=0,l=arr.length;iif(((arr[i] ") in obj)) {
a.push(arr[i]) ;
}
obj[arr[i]]="";
}