input in node code example
Example 1: javascript console input
var input = readline();
var input = prompt("Enter input:");
Example 2: user input node javascript
const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout}); readline.question('Who are you?', name => { console.log(`Hey there ${name}!`); readline.close();});
Example 3: get input from user in nodejs
const prompt = require('prompt-sync')(); const name = prompt('What is your name?');console.log(`Hey there ${name}`);