Skip to content

Instantly share code, notes, and snippets.

@kerryChen95
Created March 28, 2013 18:13
Show Gist options
  • Save kerryChen95/5265541 to your computer and use it in GitHub Desktop.
Save kerryChen95/5265541 to your computer and use it in GitHub Desktop.
`Object` is instance of `Function` and `Object.toString` is inherited from `Function.prototype`
> Object.prototype.toString.call({foo: 'foo'})
"[object Object]"
> Object.prototype.toString.call('fff')
"[object String]"
> Object.prototype.toString.call([])
"[object Array]"
> Object.prototype.toString.call(function () {})
"[object Function]"
> Object.toString.call(function () {})
"function () {}"
> Object.toString.call({})
TypeError: Function.prototype.toString is not generic
> Object instanceof Function
true
> Function instanceof Object
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment