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?


Hi @jaybrainer,

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



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


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


Discourse automatically capitalizes the first word in topic title.


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, 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:

Hope this clarifies. :slight_smile:


Thanks! That was a great help.