Newbie question here.
I am trying to understand callback functions better. Reading about them here, i though i grasped the idea.
function greeting (name, callback){
console.log(`Greetings ${name}`);
callback();
};
function timeOfDay (time){
console.log(`How are you this fine ${time}?`);
};
greeting ('Brad', timeOfDay('evening') );
Output
How are you this evening?
Greetings Brad
Uncaught TypeError: callback is not a function
Can someone please explain why the output is in this order? What does this error refer to and why does it appear even though the code has finished?
I first did a simple callback function along the same structure and it worked fine.
Thanks in advance Brad