![](/img/trans.png)
[英]How to count the number of arrays nested within a JavaScript object by name
[英]how to count number of arrays in nested array using javascript
我试图做一个if语句,我需要确定嵌套数组是否有一个数组。 我需要计算的是removeByNames内部的对象。 我正在使用angularJS和linq.js。 效率更高。
[{
"style":"smooth",
"color":"blue",
"data":[[600,40000]],
"name":"Subject Property",
"removeByNames":[["Product1"]],
"$$hashKey":"object:30"
}]
您可以使用数组访问和点表示法。
var jsoN = [{"style":"smooth","color":"blue","data":[[600,40000]],"name":"Subject Property","removeByNames":[["Product1"]],"$$hashKey":"object:30"}]; jsoN[0].removeByNames.length; /* or */ jsoN[0]['removeByNames'].length;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.