Skip to content

Instantly share code, notes, and snippets.

@SuperAL
Created February 27, 2018 10:04
Show Gist options
  • Select an option

  • Save SuperAL/0f0e22f0a0f680a679837dc317d6edba to your computer and use it in GitHub Desktop.

Select an option

Save SuperAL/0f0e22f0a0f680a679837dc317d6edba to your computer and use it in GitHub Desktop.
获取值类型
// Reference:https://github.com/jkchao/blog/issues/8
function getType (val) {
const str = Object.prototype.toString.call(val)
return /^\[object (.*)\]$/.exec(str)[1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment