I just simply tried to take input using javascript as I started javascript basics, why it's not running? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I just simply tried to take input using javascript as I started javascript basics, why it's not running?

https://code.sololearn.com/WYtHxTSsZ36R/?ref=app

16th Jul 2023, 12:35 PM
chetan kumar
chetan kumar - avatar
2 Answers
+ 5
If you are trying to do user input use the promp function Inside you ask what you want to ask the user in this case though im just going to make it blank let x = prompt() print(x) Whatever you type in the box when you run the program will be displayed to the console
16th Jul 2023, 12:43 PM
Junior
Junior - avatar
+ 5
let x = readLine(); works only in CodeCoach Sololearns compiler which is so created to do this. JavaScript does not have this statement. Instead you can use prompt() as above mentioned or input tag from HTML.
16th Jul 2023, 2:07 PM
JaScript
JaScript - avatar