04. Functions and Methods

For the return value of functions and methods it doesn't matter if they are regular, anonymous, named, static or of any other flavor. Only generators and asynchronous functions have their own return type. You can use isCallable() to cover async functions and generators as well.

Input value getType() returns is<Type>() function(s)
() => {} Function isFunction(), isCallable()
function () {} Function isFunction(), isCallable()
function bar() {} Function isFunction(), isCallable()
function* generator() {} GeneratorFunction isGeneratorFunction(), isCallable()
async function() {} AsyncFunction isAsyncFunction(), isCallable()
class Foo {
    anyMethod(){...}
    static otherMethod(){...}
}

const fooObj = new Foo();
Input value getType() returns is<Type>() function(s)
fooObj.anyMethod Function isFunction(), isCallable()
Foo.otherMethod Function isFunction(), isCallable()