[英]Getting length of an object property which is a property of an array of objects
So, I want to get the length of an object property which is a property of an array of objects. 因此,我想获取对象属性的长度,该对象属性是对象数组的属性。
I want to get the length of actionDetails
. 我想获得
actionDetails
的长度。
I tried the following: message[0].actionDetails[0].length;
我尝试了以下操作:
message[0].actionDetails[0].length;
but this is resulting in undefined. 但这导致未定义。
The data goes like this: 数据如下:
message= [
{
"data":"1",
"actionDetails":[
{
"type":"action",
"url":"http:\/\/localhost\/app\/dashboard"
},
{
"type":"action",
"url":"http:\/\/localhost\/app\/dashboard"
},
{
"type":"action",
"url":"http:\/\/localhost\/app\/dashboard"
}
]
I tried the following: message[0].actionDetails[0].length;
我尝试了以下操作:message [0] .actionDetails [0] .length; but this is resulting in undefined.
但这导致未定义。
Almost there, you don't need to get 0
th index of the array first whose length you are looking for 几乎在那里,您不需要先获取要查找其长度的数组的第
0
个索引
message[0].actionDetails.length;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.