Prompt() returns error "prompt is not defined"

I am not sure why this is happening. Programming in javascript. error output below.

ReferenceError: prompt is not defined
at Object. (/home/ccuser/workspace/javascript_101_unit_1_v10/stringInterpolation.js:1:63)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

Can you be more specific about your problem? Post your code maybe?

1 Like

Hi @jaybrainer,

If you’re asking about JavaScript, JavaScript is Case-Sensitive. If so, it should be prompt() instead of Prompt().

Refer:

Oh yes that was just the title being capitalized. I mean prompt()

1 Like

If I type prompt() into the Codecademy lessons, it returns the error mentioned in post

1 Like

Discourse automatically capitalizes the first word in topic title.

1 Like

Hi @jaybrainer,

Sorry for the late reply, if I remembered correctly, there are certain lessons preventing users to write prompt() in the test learning environment (don’t ask me why). That is probably what causing the error. Else, you can head on to a cloud IDE such as https://repl.it/languages/javascript, paste your code to see whether your prompt() is working well.

I found the topic that I replied quite some time ago, the user is facing prompt is undefined issue as well, here:
https://discuss.codecademy.com/t/prompt-not-allowed-in-some-lessons/269171/2?u=codexthon

Hope this clarifies. :slight_smile:

1 Like

Thanks! That was a great help.

1 Like