0
How may i take input in js ?
I am unable to take input from user directly using prompt() function in my vs code ? I have downloaded all things like node js and npm . But i have to use Const prompt = require("prompt sync") ({sigiint: true}) ; May i use it without it and how ?
2 Answers
+ 5
JavaScript input
In the browser you can use prompt() or read input from various form controls. Reading from forms is usually triggered by an onclick event from a button. However, an onchange event can also be used.
If you are using JavaScript outside the browser then...
Node.js has it's own way of doing things using the readline package.
JScript (Windows Script Host) has the WScript.StdIn object when run in console mode.
The SpiderMonkey JavaScript Engine has a readline() function to read a line of input from stdin.
The Nashorn JavaScript engine provides a readLine() function to read a line of input from stdin, or can use a Java class to read console input.
The Rhino JavaScript Engine can call Java so it has access to all of the Java input methods.
/Martin Taylor/
https://www.w3schools.com/js/js_input_examples.asp
+ 3
website or console?