Created
April 30, 2014 18:07
-
-
Save bretdavidson/43059c3b4f516278cf2e to your computer and use it in GitHub Desktop.
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
// Douglas Crockford typeOf function | |
function typeOf(value) { | |
var s = typeof value; | |
if (s === 'object') { | |
if (value) { | |
if (value instanceof Array) { | |
s = 'array'; | |
} | |
} else { | |
s = 'null'; | |
} | |
} | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment