Unable To Use prompt() in NodeJS

I am getting the following error while using the prompt() method in javascript :

ReferenceError: prompt is not defined

Repl link:

:wave: Welcome to the community, @TathagataBhatt2!
Try adding semicolons (;) to the end of all of your lines of code. In JavaScript this is proper syntax and can cause unnecessary errors.

Hey @TathagataBhatt2!

Could you try this?


Thank You… It Worked!!!


this also don’t worked for me

As a JS developer, no, that was not required at all. This would do absolutely nothing. And I’m pretty sure that no semicolons usually wouldn’t cause a REFERENCE error…probably a syntax error or EOF or something

Try readline-sync and then using readline.question

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.