不知道怎么写了,求帮助。[{"pid":"0","name":"智慧定位","level":"1","industry_id":"37","scene":[{"pid":"37","name":"公车监管","level":"2","scene_id":"38"}]},{"pid":"0","name":"智慧工地","icon":"","level":"1","industry_id":"39","scene":[{"pid":"39","name":"智能安全帽","icon":"","level":"2","scene_id":"40"},{"pid":"39","name":"智慧工地-综合","icon":"","level":"2","scene_id":"41"}]}]想知道scene_id为41的对象的industry_id
2 回答
RISEBY
TA贡献1856条经验 获得超5个赞
functionfindID(arr){letid;arr.forEach(value=>{for(keyinvalue){if(key=='scene'){for(leti=0;iif(value[key][i].scene_id=='41'){ id=value.industry_id;break;}}}if(id)break;}});returnid;}console.log(findID(arr));
添加回答
举报
0/150
提交
取消