Created
October 13, 2013 08:08
-
-
Save thirdj/6959681 to your computer and use it in GitHub Desktop.
type check
func classof
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
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