var dic = {
"0" : {pid:-1},
"1" : {pid:0},
"2" : {pid:0},
"11" : {pid:1},
"12" : {pid:1},
"3" : {pid:0},
"21" : {pid:2},
"22" : {pid:2},
"23" : {pid:2},
"24" : {pid:2},
"31" : {pid:3},
"32" : {pid:3},
"33" : {pid:3},
};
for(var i in dic){
if(dic[i].pid !==undefined){
var bl = dic[i].pid;
if(dic[bl]){ //-1不是表示true吗 为什么这里用dic[bl]表示就不行呢
alert(typeof dic[bl] + " " + typeof bl + " " + typeof dic[i].pid) //为啥dic[bl]是object类型,bl与dic[i].pid是number类型,dic[bl]与bl和dic[i].pid有什么区别吗
dic[bl].child || (dic[bl].child = []);
dic[bl].child.push(i);
}}}
橋本奈奈未
相关分类