0

Why wouldn't this code work?

function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(a) { var b = "You set a reminder about "; return a + b }; main();

11th Aug 2022, 6:31 PM
Edgar Lindo
Edgar Lindo - avatar
4 Answers
0
I made it work wtih: console.log (b+a) instead of the return statement... and deleted main(); from the bottom.... But... why doesn't work the other day?
11th Aug 2022, 6:32 PM
Edgar Lindo
Edgar Lindo - avatar
0
return just returns a value to call statement. You need to catch it to use like : console.log( setReminder(eventExample)) ;
11th Aug 2022, 7:13 PM
Jayakrishna 🇼🇳
0
But wouldnt the return be called from the main() function?
11th Aug 2022, 7:33 PM
Edgar Lindo
Edgar Lindo - avatar
0
main() function calling the setReminder () function which returns a value to call statement in main() function. You can use it according to your requirement.. Like print, store, ....
11th Aug 2022, 7:37 PM
Jayakrishna 🇼🇳