可以使用以下代码来判断action的child长度是否为空:

if(arr[0].child[1].child.length === 0){ console.log("action的child长度为空"); } else { console.log("action的child长度不为空"); }

这段代码首先通过索引访问arr数组中的第一个元素,即{"type":"figure","title":"形象一"...}。然后通过索引访问该元素中的第二个child元素,即{"type":"action","child":[],"title":"动作","left":0,"widthChild":200}。最后使用length属性来获取action的child长度,并进行判断。如果长度为0,则输出“action的child长度为空”,否则输出“action的child长度不为空”。

let arr = typefiguretitle形象一imgUrlhttp116153704612255statics20230309head_20230309181605A014pngleft0widthMe200duration2childtypetextcontenttitle文本left0widthChild200typeactionchildtitle动作left0widthChild

原文地址: https://www.cveoy.top/t/topic/bzRx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录