简体   繁体   中英

How to take input from user in sublime text 3 in javascript?

I basically code in JavaScript. I am using Sublime Text 3 first time for JavaScript programming and I am facing issue while asking user for the input. I am using prompt method to take input from user and it is showing error as prompt is not defined. So what is the another way to ask for the input from user in sublime text 3 in JavaScript?

let a = prompt("write number: ");

Above code line showing error when I compile it as:

prompt is not defined

prompt() is going to work only in a browser. To capture user input for nodeJS use:

process.stdin.on('data', (data) => {});

https://www.dev2qa.com/node-js-get-user-input-from-command-line-prompt-example/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM