take input in javascript console code example
Example 1: javascript console input
//SpiderMonkey
var input = readline();
//Vanilla javascript
var input = prompt("Enter input:");
Example 2: read input from console
variable = input()
//SpiderMonkey
var input = readline();
//Vanilla javascript
var input = prompt("Enter input:");
variable = input()