taking user input in javascript from console code example
Example 1: javascript console input
//SpiderMonkey
var input = readline();
//Vanilla javascript
var input = prompt("Enter input:");
Example 2: how to get a user input in js
Copyvar name = window.prompt("Enter your name: ");
alert("Your name is " + name);