亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How to get the first few layers of keys by specifying the key. It is best to use javascript
三叔
三叔 2017-06-28 09:28:20
0
2
920

{

"特效1": [{
    "特效1_1": ["AttackArrow.json", "icon_effect1.json"]
},
{
    "特效1_2": ["effec_thudun.json"]
}

}

The object data structure is similar to this. When I know the file name AttackArrow.json, I want to get the special effect 1/special effect 1_1 through this file name. How to get it

Equivalent to when I click on the file AttackArrow.json, I want to know which folder it is in

三叔
三叔

reply all(2)
學(xué)霸

Modify your data structure and see if it is the result you want.

var obj = {"arr": [{"id": ["AttackArrow.json", "icon_effect1.json"]},{"id": ["effec_thudun.json"]}]}
function func(obj){
    for(i=0;i<obj.arr.length;i++){
        for(j=0;j<obj.arr[i].id.length;j++){
            if(obj.arr[i].id[j] == "AttackArrow.json"){
                return i,j
            }
        }
    }
}
func(obj);
console.log(i,j)
阿神

You can record the key set by adding an attribute to the target node when traversing the output

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template