I've been experiencing some issues with callbacks and getting return data as undefined.
function goodMorning(name, msg) {
return `${name} ${msg}`;
}
function greet(name, msg, cb) {
const myName = "Sairam";
console.log(`${cb(name)} ${cb(msg)} i am ${myName}`);
}
greet("Suvarna", "Good Morning", goodMorning);
After analyzing the code above, it seems that when passing the goodMorning function as a callback in the greet method, the console is logging the return data as undefined.
You can click here to view the console message for more details.