problem with prompt in node
When I use prompt("...")
in a nodejs repl, it works.
When my students use prompt("...")
in a nodejs assignment in my course, it doesn't work
The error I get is:
ReferenceError: prompt is not defined
Voters
zplusfour (890)
prompt is to take input
and in node.js to make variables you should write let
or var
before writing the name of the variable
I remember this not working for one of my
nodejs
repls.I solved it by requiring
readline-sync
:You can get user input like this:
If this doesn't work you might need to install it from the package manager first:
