Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Created December 25, 2012 23:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jasdeepkhalsa/4376385 to your computer and use it in GitHub Desktop.
Save jasdeepkhalsa/4376385 to your computer and use it in GitHub Desktop.
Check JavaScript variable type with the .toString method by ExampleJS.com
function isType(arg, type) {
type = type.charAt(0).toUpperCase() + type.substr(1);
return Object.prototype.toString.call(arg) == '[object ' + type + ']';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment