To fix this issue prompt is not defined in VS code or prompt is not working, You can follow these steps –
1. Open your terminal or command prompt.
2. To clear screen type command clear and press enter.
3. Initialize a new npm project by running the command npm init -y in your terminal or command prompt. This will create a package.json file with default values.
4. Install the prompt-sync package by running the command npm install prompt-sync in your terminal or command prompt. This package allows synchronous user input.
5. At the top of your code file, add the following line to import the prompt-sync module and create a prompt object:

const prompt = require('prompt-sync')();
6. Save the code and run the code and check that prompt functionality is working correctly.