[英]How to get array size which is inside an object?
I have an array which contains objects like this: 我有一个包含这样的对象的数组:
dataSet = [{question:"",options:[{subject:"",teacher:""}]}]
How can I get the length of the options array? 如何获得options数组的长度?
dataSet
itself an array. dataSet
本身是一个数组。 So get the first index of it and then length of options
in it like following. 因此,获取它的第一个索引,然后获取其中的
options
长度,如下所示。
var dataSet = [{question:"", options:[{subject:"",teacher:""}]}] alert(dataSet[0].options.length);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.