Skip to content

Instantly share code, notes, and snippets.

@wwsun
Created May 21, 2015 06:25
Show Gist options
  • Save wwsun/0762d72d331e675599c6 to your computer and use it in GitHub Desktop.
Save wwsun/0762d72d331e675599c6 to your computer and use it in GitHub Desktop.
Methods to check Array, Function, or RegExp
function isArray(value){
return Object.prototype.toString().call(value) == '[Object Array]';
}
function isFunction(value) {
return Object.prototype.toString().call(value) == '[Object Function]';
}
function isRegExp(value) {
return Object.prototype.toString().call(value) == '[Object RegExp]';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment