js 处理数组重复元素示例代码
内容摘要
复制代码 代码如下: function doSz{
var kzly==["a","a","c","a","b"];
for(var i=0;i<kzly.length;i++){ var targetNode = kzly[i]; for (var j=0; j<i; j++) { if(ta
var kzly==["a","a","c","a","b"];
for(var i=0;i<kzly.length;i++){ var targetNode = kzly[i]; for (var j=0; j<i; j++) { if(ta
文章正文
复制代码 代码如下:
function doSz{
var kzly==["a","a","c","a","b"];
for(var i=0;i<kzly.length;i++){
var targetNode = kzly[i];
for (var j=0; j<i; j++) {
if(targetNode == kzly[j]){
kzly.splice(i,1);
kzlymc.splice(i,1);
//alert(arr);
break;
}
}
}
}
代码注释