Similar in nature to Array.isArray.
I just found it odd that there is no simple way to do this and there are a bunch of implementations if it.

The basic intent is that:

if (Function.isFunction(x)) {

Would never throw any errors.

Current implementations: which was deprecated and recommended to use typeof x === "function"

typeof x === 'function' already achieves this, with syntax, so it's impossible for it to break (delete Function.isFunction, for example, would break your suggestion).

The more complex logic you see in lodash, and in is for older non spec-compliant engines.


And just to add onto that, there's an existing (withdrawn) proposal that looked into rounding out that matrix:

You may want to look into its history, as this commit went from Foo.isFoo(value) to, value). Also, it was only talked about once in meetings and was withdrawn in favor of Object.prototype.toString as that generally worked for 99% of cases.