I'm trying to run a simple javascript program from the command line and am getting an unexpected error. prompt seems to be a simple javascript command; not sure why it's not defined.
my test.js file:
console.log("I will now ask you for your name.");
var name = prompt("Enter your name");
console.log("Hello ".concat(name, ". How are you"));
I'm running it like this:
C:\directory\node test.js
I will now ask you for your name.
C:\directory\test.js:2
var name = prompt("Enter your name");
Reference Error: prompt is not defined
window.prompt()is a function that web browsers implement, but it is not a native function in node.js.