Skip to content

Instantly share code, notes, and snippets.

@kellyjoe256
Last active July 22, 2020 12:03
Show Gist options
  • Save kellyjoe256/4c7797a94aa7aaad657c583740ca9617 to your computer and use it in GitHub Desktop.
Save kellyjoe256/4c7797a94aa7aaad657c583740ca9617 to your computer and use it in GitHub Desktop.
An alternative way of determining type in JavaScript
function is(value) {
const toString = Object.prototype.toString;
// OR return ({}).toString.call(value).slice(8, -1).toLowerCase();
return toString.call(value).slice(8, -1).toLowerCase();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment