Answers for "nodejs stdin"

2

node print stdin

const process = require("process")
process.stdin.on('data', data => {
    console.log(data.toString())
})
Posted by: Guest on May-10-2021
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
7

readline in javascript

//Node.js readline
const readline = require('readline');

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

rl.question('What do you think of Node.js? ', (answer) => {
  console.log(`Thank you for your valuable feedback: ${answer}`);
  rl.close();
});
Posted by: Guest on June-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language