How to efficiently count the number of keys/properties of an object in JavaScript?
The fastest way to count the number of keys/properties of an object
If we were using Underscore.js you can use _.size _.size(obj)
Alternatively we can also use _.keys which might be clearer for some:
_.keys(obj).length