Answers for "input in terminal javascript"

5

promp node js

const readline = require("readline");

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question("What is your name ? ", function saveInput(name) {
  console.log(`His name is ${name}`);
  rl.close();
});

rl.on("close", function saveInput() {
    console.log("\nBYE BYE !!!");
    process.exit(0);
});
Posted by: Guest on May-16-2020
0

javascript read input from terminal

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
 
readline.question('Who are you?', name => {
  console.log(`Hey there ${name}!`);
  readline.close();
});
Posted by: Guest on February-13-2021

Code answers related to "input in terminal javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language