Created
January 15, 2015 21:57
-
-
Save peijiehu/b2da33a1235110c07aea to your computer and use it in GitHub Desktop.
Get number of properties in 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
function arrayLength(obj) { | |
if (typeof(obj) == 'string') { | |
return 1; | |
} else { | |
return obj.length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment