Why my prompt is not working?

Question:
My prompt is not working in the Javascript. It gives error as prompt is not defined.

Repl link:

code snippet

Hey, @Gaurav-rathi-B1 welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

prompt does not exist in Node.js. If you wish to use it either:

  1. Use the HTML/CSS/JS template. This creates a web app you can add UI to.

  2. Use something like prompt-sync:

const prompt = require('prompt-sync')();

// Get input from the user:
const answer = prompt('How many more times? ');
1 Like