I have this array structure:
mdarray = {
'0001':{address:'add1',title:'title1'},
'0002':{address:'add2',title:'title2'},
'0003':{address:'add3',title:'title3'}
};
I wish to only work with the array if it has one or more items in it. Usually with an array I would use if (mdarray.length > 0) {}
but when I do this with the array above, mdarray.length
returns 'undefined'.
Is this is because it is an array of arrays? Is there another way to very simply pull back the number if items in the root of the array?
Or it is because the keys are strings and not integers?
I've played about with different array structures and read about multidimensional arrays but I've not yet found an answer.