Last active
May 19, 2016 02:14
-
-
Save joshuacerbito/1f95f0eaefa7a594d84ebbeebf285c3c to your computer and use it in GitHub Desktop.
Get the size of an object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.size = function ( obj ) { | |
var size = 0, key; | |
for (key in obj) { | |
if ( obj.hasOwnProperty(key) ) { size++; } | |
} | |
return size; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment