What is wrong with this code? | SoloLearn: Learn to code for FREE!

+3

What is wrong with this code?

https://code.sololearn.com/WeeH0GREqrSW/?ref=app This is a code coach problem. It gives me output in code playground but not in code coach. What went wrong in this code. Pls help me ( Javascript code coach - important reminders). I have mentioned about the task in brackets. The code coach problem is in function parameter lesson of javascript. Here is the problem 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

10/25/2020 10:24:03 AM

Tushita Priya

31 Answers

New Answer

+4

Use prompt method in order to get user input Code: //////////////////// var input = prompt("Enter something"); // function call if (input == "") { input = "workout" setReminder(input); } else { setReminder(input); } //complete the function function setReminder(name){ alert("You set a remainder about " + name); }

+2

Abhay He means the task in these lessons(2nd page). https://www.sololearn.com/learn/JavaScript/1146/ It is considered code coach in SoloLearn. The input doesn't have space before the word. You need to add space after the sentence.

+2

1. "CODE COACH" only accept console function.. that print, read console line, throw error and exception about your program.. 2. You didn't put the read console line function in your code.. and print the result in the wrong way.. 3. For reading console line you need "readline()" function.. And for print it in your console, use "console.log(value)" Example: //use readline to variable that you want to use var str = readline(); //this will return string var i = parseInt(readline()); //this will return integer if you don't put another string except number and decimal point declaration //use console log to print everything to the console console.log(str); //this will print string console.log(i); //this will print number var txt = str + i; //this will convert every number into string and combine it into the string if the string declared first console.log(txt); //this will print string var sum = i + 5; console.log(sum); //this will print number Input: Hello World! 10 Output: Hello World! 10 Hello World!10 15 :>

+1

There is no method such as readLine() in node,I even Googled to make sure there is no method like it ,however node has one such as readline() module for input output stuff, https://www.google.com/url?sa=t&source=web&rct=j&url=https://nodejs.org/api/readline.html&ved=2ahUKEwj6z5rfxs_sAhWZzzgGHeo8ChUQFjACegQICxAB&usg=AOvVaw1kx1u0u8EqUN9WwYIxiNH7&cshid=1603622590541 The code you are trying isn't for Javascript in browser , The code playground used for the above code coach is node which is Javascript runtime environment used for execution of JavaScript outside browser , probably node is calling main method itself and therefore any other function call inside it executes (If someone knows that there is really a method readLine() like used in the above code coach let me know )

0

There is... They'd added newly

0

What's your android version

0

It's a code coach I have given the problem check it out

0

Maybe that's why u r not getting them. Your android version is old or it might be a glitch. Do you have new interface in the app. They changed the learn interface

0

Tushita Priya I don't know what you are talking about Java ,but Java and JavaScript are different ,if you think there is readLine method in JavaScript and node can you provide a link?

0

alert works well in js ,can you show what you are trying? alert isn't available in node tho

0

Tushita Priya remove last 3 lines , "reminder" is not spelled as remainder, use console.log , adjust for single space after "about " should work now 👍

0

You need to call main function and you don't have readLine method.

0

Thanks a lot for aiding and supporting me.

0

M*S €(^-^() I tried using console.log too but it's the same result

0

Matteo Rocco Micò yeah it is working well in playground but it is not in codecoach

0

U can use document.write instead of console.log to get output on screen

-1

There is no code coach for JavaScript

-1

Updated my app ,still there is no code coach for it

-1

From what I see is you are talking about a lesson but that is definitely not a code coach

-1

7 is definitely not that old 😅 ,anyway I see it ,they aren't available in code coaches ,but in lessons ,