Introduction to Callbacks

Callbacks are functions that are passed to other functions as parameters. They're necessary for asynchronous code, encapsulation, eliminating code repetition, and so much more. The fact that functions are first-class objects in JavaScript is part of what makes the language so powerful.

One of the most powerful properties of JavaScript is that functions are first-class objects. This means that they are like any other object and have the same properties as standard objects. In fact, we should think of them as nothing more than callable objects.

Like an object, we can store properties on a function.

Get hands-on with 1200+ tech skills courses.