Skip to content

Instantly share code, notes, and snippets.

@bretdavidson
Created April 30, 2014 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bretdavidson/43059c3b4f516278cf2e to your computer and use it in GitHub Desktop.
Save bretdavidson/43059c3b4f516278cf2e to your computer and use it in GitHub Desktop.
// 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