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
KAlexK
November 7, 2023, 3:06pm
2
You mean using the prompt
and alert
functions in Node.js?
Yes I mean those functions that you mentioned
KAlexK
November 7, 2023, 3:29pm
4
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
KAlexK
November 7, 2023, 3:38pm
6
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?
KAlexK
November 7, 2023, 3:43pm
8
I have no information about why this was done.
gound2002:
pro version
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
system
Closed
November 14, 2023, 3:45pm
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.