Types of Function Headers

In this lesson, we will see three function signatures.

Function with parameters

A function’s signature can have a parameter that is a function too. These function’s parameters can have parameters at their turn but don’t require the invoker to use the parameters. A standard scenario is for an optional callback function.

For example, say you have a function that lets you specify an optional error callback named error of type Error. Not using the argument occurs when notification by the callback is important, but not the details from the argument. The reason is that behind it, JavaScript provides the ...