Skip to content

Instantly share code, notes, and snippets.

@kitsune7
Last active December 12, 2018 23:00
Show Gist options
  • Select an option

  • Save kitsune7/1a60321140bf2f01609c4c8a8ceb8440 to your computer and use it in GitHub Desktop.

Select an option

Save kitsune7/1a60321140bf2f01609c4c8a8ceb8440 to your computer and use it in GitHub Desktop.
/*
* @param variable The variable you want to get the type of
* @returns 'string', 'number', 'array', 'function', or 'object'
*/
function type (variable) {
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment