Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// 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