length property which gives you the number of properties / items in an object. The most common way of getting the number of properties is to loop through the object - not pretty, resource intensive.
Object.keys(). However, inferior browsers such as Internet Explorer are known not to support such useful features.
Object.keys() static method accepts an objects and returns an array of natively defined keys of the objects, those which pass the
hasOwnProperty() test. Just count the length of the returned array, and you have the size of the object / number of items or properties in the object."
- MDN - Object.keys()