Skip to content

Instantly share code, notes, and snippets.

@peijiehu
Created January 15, 2015 21:57
Show Gist options
  • Save peijiehu/b2da33a1235110c07aea to your computer and use it in GitHub Desktop.
Save peijiehu/b2da33a1235110c07aea to your computer and use it in GitHub Desktop.
Get number of properties in an object
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