Getting the size of an array in an object Getting the size of an array in an object arrays arrays

Getting the size of an array in an object


Javascript arrays have a length property. Use it like this:

st.itemb.length


Arrays have a property .length that returns the number of elements.

var st =    {        "itema":{},        "itemb":        [            {"id":"s01","cd":"c01","dd":"d01"},            {"id":"s02","cd":"c02","dd":"d02"}        ]    };st.itemb.length // 2