Why can't I use prompt() to collect input?


#1

Hi,

I’m working on the sample exercise for Javascript functions and I don’t understand why I can’t use prompt() to collect the user input here. I tried reformatting it as Window.prompt() – as per the javascript docs – but then I get an error saying it can’t find “Window” (even though the syntax highlighting colors it as though it’s good).

Confused :frowning:


#2

Nevermind! Found out it’s just an issue with how the exercises are built. It would work in real life but I need to stick to the specific exercise and what it asks me to do. :slight_smile:


#3

js often runs in browsers, but these exercises use nodejs which is entirely server-side
prompt is a browser function, doesn’t exist in node, because node doesn’t have a gui to show it in


Prompt not allowed in some lessons?
#4

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