How do I prompt user for input in Sublime?

I have the Sublime IDE up and running. I have it configured so the console works and I can check my code as I go. However, I cannot figure out how to prompt the user for input.

How do I prompt the user for input? I’ve tried prompt(""); as well as window.prompt(""); and no luck.


Did you set your prompt as a var? Like so: var answer = prompt("Enter answer");

1 Like

Code is:

var answer = prompt(“Enter answer:”);

Result is:

C:\Users\Chris\AppData\Roaming\Sublime Text 3\Packages\User\sample:1
(function (exports, require, module, __filename, __dirname) { var answer = prompt(“Enter answer:”);

ReferenceError: prompt is not defined
at Object. (C:\Users\Chris\AppData\Roaming\Sublime Text 3\Packages\User\sample:1:76)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:134:18)
at node.js:962:3
[Finished in 0.3s]