Bug in Node js where we can't take input from user and it throws an error

Problem description

So the problem i found in NODE JS where whenever i try to take input from it kept throwing an error and don’t work
So in Javascript we take input using prompt but replit shows an error

Expected behavior

asking for input from user

Actual behavior

Error throwing

Steps to reproduce

Go to node js and write code for taking input from user

Browser

chrome

OS

Windows

Device if mobile

Android

Plan

Free trail

Hi @suyashMishra3 , welcome to the forums!
prompt() was removed from the Node.js template. To use it, use the prompt-sync library.

const prompt = require('prompt-sync')()
// You can now use it:
prompt('Enter your name >')

Hope this helps!

2 Likes

Here’s another problem i’m stuck with node js.
I can’t able to use Arrays methods like
join(), pop(), push()…
Can you please help with the correct syntax.

Hey @suyashMishra3!

Can you provide your code, so we can take a closer look at what’s wrong?
Here’s a link to methods for arrays to see if you can fix it → JavaScript Array Methods.