Callbacks and Higher-Order Functions

A callback is a function passed as an argument to another function.

function greet(name, callback) {
  console.log("Hello, " + name);
  callback();
}

greet("Harshal", function () {
  console.log("Welcome to advanced JS!");
});

A higher-order function is any function that takes another function as a parameter or returns a function.

← PrevNext →