Ask coding questions

← Back to all posts
Get nodejs to wait for user input to console
mwilki7

How would I get nodejs to wait for me to enter something into the console?
I am using 'readline' but it looks like it skips it anyway.
Is this a repl terminal problem?

Answered by Vandesm14 [earned 5 cycles]
View Answer
Voters
Llatepate
JoshuaHills1
mwilki7
Comments
hotnewtop
Vandesm14

Use readline-sync instead. Readline is asynchronous, meaning it will trigger a function on input instead of trigger an input instance.

Please mark this as answered if I helped your problem 👍

mwilki7

@Vandesm14 Thanks