data.lclrilist[i].brand 获取到的值中有重复的,如何才能去重??
var innerhtml = "";
for (var i = 0; i < data.lclrilist.length; i++) {
innerhtml+="<li onclick=upvalue08(this,'" + data.lclrilist[i].brand + "') onmouseover=mouseOver(this) onmouseout=mouseOut(this)><a href='javascript:void(0)'>"+data.lclrilist[i].brand+"</a></li>";
}
$("#brand").html(innerhtml);
var only = {}
for(xxx){
if(only[brand])
continue;
}
}
var list = {};
for (var i = 0; i < data.lclrilist.length; i++) {
if(list[data.lclrilist[i].brand]){
continue;
}
alert(list);
}
这样写吗?? 可还是不对啊
@kmanng: ╮(╯Д╰)╭
var only = {}
for(xxx){
if(only[brand])
continue;
}
only[brand]=true
}
@长蘑菇星人:
这次对了!!问一下这是什么原理呢??
@kmanng: ╮(╯Д╰)╭难道你的数据会自己告诉你它重复了?
@长蘑菇星人: 懂了