CallBack & Promises
By the end of this lecture, students will be able to:
A callback function is a function that is:
Passed as an argument to another function and executed later
function greet(name, callback) {
console.log("Hello " + name);
callback();
}
function sayBye() {
console.log("Goodbye!");
}
greet("Alex", sayBye);
✔ sayBye is a callback
✔ It runs after greet finishes its work