Hello everyone,
I'm a beginner here and I have a question about callback functions. Upon reading about them, I felt like I understood the concept. However, when I attempted to implement one in my code, things didn't go as planned.
function greeting (name, callback){
console.log(`Greetings ${name}`);
callback();
};
function timeOfDay (time){
console.log(`How are you this fine ${time}?`);
};
greeting ('Brad', timeOfDay('evening') );
Here's the output:
How are you this evening?
Greetings Brad
Uncaught TypeError: callback is not a function
Could someone please help me understand why the output is in this particular order? What does the error mean, and why does it appear even though the code seems to have finished executing?
Previously, when I tried a simpler callback function with a similar structure, it worked without any issues.
Thank you all for your assistance! - Brad