Prompt and Alert Function Help

Question:

Can anyone tell me if ever you implemented a code in JS, did replit gave error while compiling the function “prompt or alert”? I tried on a different complier they both are working but in replit, it’s not recognizing them as function.

Replit Profile: https://replit.com/@gound2002

You mean using the prompt and alert functions in Node.js?

Yes I mean those functions that you mentioned

In Node.js has no built-in prompt and alert functions, but you can use other similar functions instead.

Instead of the alert function, you should use the console.log function.

To use the prompt function in Node.js you should use the prompt-sunc library:

const prompt=require('prompt-sync')()
prompt('Enter your name:')

As I was following this youtuber, he was able to execute both of them on replit

Most likely, he used an old version of the Node template.the js in which these functions were.

2 Likes

Do you know as to why did they remove these functions or did they limit the use of all library functions only to the pro version?

I have no information about why this was done.

No one said that these functions are limited to the pro plan. The alert and prompt functions are also unavailable for pro users without additional installation.

1 Like

oh, thank you so much for the info

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.