How do you get user input in Node js? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

How do you get user input in Node js?

I looked into it and I don't get it, I tried using require("prompt-sync") but the module doesn't exist.

7th Aug 2020, 8:27 AM
Clueless Coder
Clueless Coder - avatar
4 Respostas
+ 15
The "readline" example seem to work in the playground https://nodejs.org/en/knowledge/command-line/how-to-prompt-for-command-line-input/ The "prompt" example fails :/
7th Aug 2020, 8:35 AM
Burey
Burey - avatar
7th Aug 2020, 10:20 AM
CalviÕ²
CalviÕ² - avatar
14th Oct 2020, 6:29 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 3
Burey Thanks for the answer, it needs some tweaking but seems to work https://code.sololearn.com/czue8PZUmQog/?ref=app
7th Aug 2020, 8:41 AM
Clueless Coder
Clueless Coder - avatar