How do you access the STDIN input with JavaScript?
1079
How do you access the STDIN input so that I can save it into a variable? (I'm using JavaScript).
Embarrassingly, I'm on the second task of the Beginner's Coding Challenge:
Scan name of user and say Hello
*Write a program to scan the name of the user and say hello to them.
Example input:
Peter
Example output:
Hello Peter*
While I can write a program that works in a generic console (using the prompt method), I can't get it to run in the OneCompiler, because it says prompt is not defined. So I take it that the STDIN input is replacing the actual mode of input, in which case, how can I refer to the STDIN input in my code, so that I can complete the challenge?
2 Answers
@Bella Gladman
Please find the sample program in Javascript with STDIN below, We support it via readline
https://onecompiler.com/javascript/3y5prbmjv
Update: Updated the code, please check now
Thank you for your help... the program given doesn't pass either of the two test cases, despite running successfully?