Callback functions

A callback is a function passed as an argument to another function, which calls it later or on each occurrence of an event. It is at the heart of array methods, events, and legacy asynchronous code. Nesting too many callbacks harms readability.

Example

boutons.forEach((b) => console.log(b.textContent))

Related concepts

The whole glossary