Answers for "take input command line node.js"

2

get input in terminal nodejs

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 May-27-2021
0

how to take input from user nodejs

const prompt = require("prompt-sync")();

const input = prompt("What is your name? ");

console.log(`Oh, so your name is ${input}`);
Posted by: Guest on December-20-2021

Code answers related to "take input command line node.js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language