JavaScript Asynchronous Programming with JavaScript Asynchronous JavaScript with Callbacks Callback Functions Review

Olivia Posch
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Olivia Posch
Front End Web Development Techdegree Graduate 19,704 Points

Set the makeMeal function to invoke the callback function passed to it.

Hi Everyone! can you please help me. I am not sure what I have to write here:

function makeMeal(meal, cb) {
  alert(`Preparing ${meal}.`);
  return cd();     <- Answer?? it should be anonyme function Right?
   or:
  return cd 
}
makeMeal('lunch', () => {
  alert('Finished the meal!');
});

🙆‍♀️🤷🏼‍♀️

Thank in advanced!

2 Answers

imo
imo
7,891 Points
// You typed
cd();
// but the callback function is named
cb();
// Also they just want us to just call it, no need to return it, so just
cb(); // works fine