Skip to content

Instantly share code, notes, and snippets.

@thirdj
Created October 13, 2013 08:08
Show Gist options
  • Save thirdj/6959681 to your computer and use it in GitHub Desktop.
Save thirdj/6959681 to your computer and use it in GitHub Desktop.
type check func classof
function classof(o){
if (o === null) return 'Null';
if (o === undefined) return ' Undefined';
return Object.prototype.toString.call(o).slice(8,-1);
}
/*
* use: classof(false); // 'Boolean'
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment