Skip to content

Instantly share code, notes, and snippets.

@jcready
Last active April 12, 2016 16:09
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 jcready/4972086 to your computer and use it in GitHub Desktop.
Save jcready/4972086 to your computer and use it in GitHub Desktop.
Better typeof() Function
var typeOf = (function(_, g, u) {
return function(o) {
return o === g
? 'global'
: o == u
? o === u
? 'undefined'
: 'null'
: o !== o
? 'NaN'
: _.toString.call(o).slice(8, -1)
};
})({}, this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment