802Objects and Key Array Length in Javascript
With arrays is trivial to get the length, with objects, the situations is slightly different. One approach would be to get all the keys and get the length of that array:
Object.keys(myObject).length;
More details at Stackoverflow. This functionality is part of EMCAScript 5 specs.