Closed gwtuser closed 5 years ago
yeah this seems more like a bug in your code - but prompt is definitely not a reserved word.
There is a global prompt
in the browser, but this package is for Node.js.
Closing as this is not an issue with this module.
When I install and attempt to use prompt-sync, the basic sample code works if run all by itself, but if
var prompt = require('prompt-sync')();
is put at the top of a JavaScript class file (global scope) and then
var n = prompt('How many more times? ');
Is put inside a class method defined in that file (where it should have access to the variable), it crashes claiming that 'prompt' isn't defined. If I change the definition to use 'prompt2', things work. So you should probably avoid using 'prompt' as a variable as it's a JS reserved word.