Callbacks are functions passed to async operations. They run when the operation completes, receiving the result.
function fetchUser(id, callback) {
// Simulated async operation
setTimeout(() => {
callback({ id, name: "Alice" });
}, 100);
}
fetchUser(1, (user) => {
console.log(user.name); // "Alice"
});