Hi, could someone help me with this task? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Hi, could someone help me with this task?

The task is this: Sometimes it is very useful to set reminders to help you accomplish all your tasks. The program you are given takes an event as input. Complete the function reminder to take that event as an argument and output the corresponding message. input example workout output example You set a reminder about workout Use the + operator to concatenate string values ​​together. eg console.log("JS is " + "fun!") will output "JS is fun". And this is the code that the task give me and in the one I'm working function main() { var eventExample = "workout"; setReminder(eventExample); } //completa la función function setReminder(eventExample) { alert("Remember to" + " " + eventExample ) } setReminder("workout"); But is not working, and honestly I'm a bit lost and I don't know what to do, if somebody could help it would be great

16th Dec 2022, 1:18 AM
Alan Restrepo
Alan Restrepo - avatar
4 Antworten
+ 2
The task requires your code to read a string input which represents event name. Your code uses a statically hardcoded string "workout" rather than reading an input. When attempting a code challenge, carefully note the task. We must do exactly what the task asked for, nothing more and nothing less. If the task says we call setReminder() inside main(), then we do it. Don't call setReminder() again - outside main()
16th Dec 2022, 1:46 AM
Ipang
+ 2
Alan, usually the coach provided some code for reading input already. See if such code existed in the coach page, don't remove it, cause it is necessary.
16th Dec 2022, 3:31 AM
Ipang
0
Ipang yes you are right, but I did what you said in the code play ground and it worked, but in the code couch doesn't do you know why? This is the code by the way that work in the code play ground function main() { var eventExample = "read a book"; setReminder(eventExample); } //completa la función function setReminder(eventExample) { console.log("Remember to" + " " + eventExample ) } main(setReminder);
16th Dec 2022, 2:07 AM
Alan Restrepo
Alan Restrepo - avatar
0
Ipang you're right, the code that I show you it's exactly the same, the only difference is that I take the part in (var event example = readline () ) because the readline part is for an input use in node js, i always made the code this way and after a change it in order to work with the original code, the thing is that I don't know what is wrong now
16th Dec 2022, 3:39 AM
Alan Restrepo
Alan Restrepo - avatar