Question:
Replit Profile: https://replit.com/@ChandraMohan27
showing error in code
Welcome to Ask!
Instead of instantly giving you the code, I’ll explain it step-by-step.
So the first thing you do is read the error. Is it a SyntaxError? A ReferenceError? (There are a lot of different errors. You can find their names and reasons in Google.)
Then you try to find out why that error is happening. For example, if you’re getting a ReferenceError, that means you’re trying to use something that’s not defined. So this means that prompt() is not defined.
The next thing you need to do is try to solve the error. If prompt() doesn’t exist, you need to find another way to get input from the user. If you can’t find a way, Google is your best friend. I like to look at it like this:
So how do you get input from the user? You can use a package called readline.
Hope this helped
It’s not working
Can u explain in simple words ?
Can you explain what’s not working? Sorry for the late reply btw.
Actually prompt and alert function is not working in javascript
Try this to make prompt
work:
Alert function is not working in js
As it is showing object not found
Isn’t alert
for vanilla JS only? not node?
You should be using console.log
. As @QwertyQwerty88 suggested, prompt
and alert
are not actually a part of Node.JS, instead, Replit previously added them automatically but has stopped doing this now and does not intend to bring this back.