+ 2

Function Parameters

//I’m new to JS, so please bear with me. Sometimes it’s very useful to set reminder to help you accomplish all of your tasks. The program you are given takes an event as input. Complete the function-reminder to take that event as argument and output the corresponding message. Sample Input workout Sample Output You set a reminder about workout https://code.sololearn.com/cuiD0EgI5o5W/?ref=app

5th Dec 2021, 6:50 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
21 Answers
+ 7
It's not necessary to call main() in Js practices since it's done by the compiler itself. //main()
7th Dec 2021, 8:23 AM
Simba
Simba - avatar
+ 3
It's a pro-content. And coaches are private once. Others can't see your code. Share your code link by saving it in playground and needed details of problem... Hope you understand..
5th Dec 2021, 6:56 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 That code gave the following: ./Playground/file0.js:4 var eventExample = readLine(); ^ ReferenceError: readLine is not defined at main (./Playground/file0.js:4:24) at Object.<anonymous> (./Playground/file0.js:12:1) at Module._compile (internal../Playground/:1063:30) at Object.Module._extensions..js (internal../Playground/:1092:10) at Module.load (internal../Playground/:928:32) at Function.Module._load (internal../Playground/:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47
5th Dec 2021, 8:55 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 2
//Tahiti🍷 if it is JS project of function parameters, then this code worked for me. I tested it now. function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(eventExample) { console.log("You set a reminder about "+ eventExample); }
8th Dec 2021, 10:29 AM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 It took me some time to get everything added. The system does not allow me to paste all information at the top in the question field. I had to enter the instructions and my code as replies. Others had already begun posting replies before I was finished adding information.
5th Dec 2021, 7:00 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
//try this: function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(eventExample) { console.log("You set a reminder about " + eventExample); }; main();
5th Dec 2021, 7:27 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 I used your code: function main(){ const rl = require('readline'); const rls = rl.createInterface({ input: process.stdin, output: process.stdout } ); rls.on('line', (input) => { console.log(`You can add reminder to ${input}`); }); } main(); /*And the output was: You can add reminder to */ /*But I don’t understand the code, because the tutorial didn’t teach any of this above. I don’t understand the meaning of readLine and how it fits in. I think I need to get further through the tutorial to understand better. Thank you.*/
6th Dec 2021, 5:23 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
This is one way of taking input in node.js manually .. Importing readline into program to use it. rl is a readline instance of added library Next line creates an interface for input dialogue box Next line process input on input text .. Iam not much know about it more, about node.js. I found it on net source. Just gave for temporary unlock a lesson.. Hoping may helps.. But it should work without those as it before. But what is the way sololearn supporting input now idk.. edit: https://nodejs.org/docs/latest-v15.x/api/readline.html Tahiti🍷 You're welcome...
6th Dec 2021, 5:40 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 to your question about my code for Logical or Boolean Operators, here is the code that worked for me: function main() { var hour = parseInt(readLine(), 10); // Your code goes here var meridiem = (hour <=12) ? "am": "pm"; console.log(meridiem); }
6th Dec 2021, 5:45 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
Jayakrishna🇮🇳 Thanks again. I tried your code above. My code bit is here: https://code.sololearn.com/cL4tK8gut4wc/?ref=app It still throws an error. 😵‍💫
7th Dec 2021, 12:49 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
Jayakrishna🇮🇳 There is no error. The console says “No output” when I run the code.
7th Dec 2021, 11:42 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
Jayakrishna🇮🇳 Thank you for not giving up! You are awesome! The problem was that I was copying and pasting your helpful code into the playground. For some reason, it says “No output” as a result. But after you reported that you tested it and it worked, I decided to paste it into the Code Coach exercise, and it worked there! 😵‍💫😁 Thank you, my friend! 🏆
8th Dec 2021, 4:40 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
+ 1
😇 you're welcome.. Tahiti🍷 👍
8th Dec 2021, 4:50 PM
Jayakrishna 🇮🇳
0
Defaultly it should work.. Otherwise it need to import third party libraries.. edit: Tahiti🍷 in this , is your code worked fine before? https://www.sololearn.com/Discuss/2896745/?ref=app edit: function main(){ const rl = require('readline'); const rls = rl.createInterface({ input: process.stdin, output: process.stdout } ); rls.on('line', (input) => { console.log(`You set a reminder about ${input}`); }); } main();
6th Dec 2021, 2:59 PM
Jayakrishna 🇮🇳
0
//Yes. In same way this should work. But may sololearn changed settings or code playground not working this way.. I don't know. function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(eventExample) { console.log("You set a reminder about " + eventExample); }; main(); Forget tempararly, go with next. edit: //the output text in last post, I edited to console.log(`You set a reminder about ${input}`) ;
6th Dec 2021, 5:57 PM
Jayakrishna 🇮🇳
0
Simba Thank you. When I remove the “main()”, the console says No output. Likewise, the console says No output for the following code: function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(eventExample) { console.log("Remember to " + eventExample) }; //I don’t understand how it should be coded to give a correct output.
7th Dec 2021, 3:53 PM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
0
What is the error there ? is it same or different?
7th Dec 2021, 7:13 PM
Jayakrishna 🇮🇳
0
Can you help me please 🥺?
4th Oct 2022, 4:05 AM
Sarfraz Ahmed Jamali
Sarfraz Ahmed Jamali - avatar
0
//I hope this will be helpful for u function main() { var eventExample = readLine(); // function call setReminder(eventExample) } //complete the function function setReminder(event) { console.log('You set a reminder about '+ event); };
5th Nov 2022, 8:07 PM
Be Rain
Be Rain - avatar
- 1
Bonsoir je suis nouveau ici
7th Dec 2021, 5:57 PM
serge abby pacome