Is there a way to get (from somewhere) the number of elements in a javascript object?? (i.e. constant-time complexity).
I cant find a property or method that retriev
To do this in any ES5-compatible environment
Object.keys(obj).length
(Browser support from here) (Doc on Object.keys here, includes method you can add to non-ECMA5 browsers)