1const readline = require('readline').createInterface({
2 input: process.stdin,
3 output: process.stdout
4});
5
6readline.question('who are you: ', name => {
7 console.log(`hello, hi there ${name}`);
8 readline.close();
9})
1const readline = require("readline");
2
3const rl = readline.createInterface({
4 input: process.stdin,
5 output: process.stdout
6});
7
8rl.question("What is your name ? ", function saveInput(name) {
9 console.log(`His name is ${name}`);
10 rl.close();
11});
12
13rl.on("close", function saveInput() {
14 console.log("\nBYE BYE !!!");
15 process.exit(0);
16});
1const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout}); readline.question('Who are you?', name => { console.log(`Hey there ${name}!`); readline.close();});