Sample code fails if used within a class method, presumably because 'prompt' is a reserved word
gwtuser opened this issue · 2 comments
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.
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.