Callback Function

noun

say it: “KAWL-bak FUNGK-shun” /ˈkɔːlbæk ˈfʌŋkʃən/

A function you pass to other code, to be called later, such as when a click happens.

What is Callback Function in JavaScript?

Callback Function — A function passed to other code to be called later or during an operation.

function greet(name) {
    return `Hello, ${name}`;
}

const names = ["Ada", "Lin"];
const greetings = names.map(greet);

In a sentence

  • “The callback runs each time the button is clicked.”

Level: Apprentice · More JavaScript terms at this level

Updated