Unable To Use prompt() in NodeJS

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

ReferenceError: prompt is not defined

Repl link:
https://replit.com/@TathagataBhatt2/ArraysPracticeSet

: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.

1 Like

Hey @TathagataBhatt2!

Could you try this?

5 Likes

Thank You… It Worked!!!

3 Likes

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.