//using npm module
/*
npm install prompt-sync
# or
yarn add prompt-sync
*/
const prompt = require('prompt-sync')();
const input = prompt('What is your name? ');
console.log(`Oh, so your name is ${input}`);
//* or using readline
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question('What is your name? ', function (answer) {
console.log(`Oh, so your name is ${answer}`);
console.log('Closing the interface');
rl.close();
});
//* for brouser input
const input1 = prompt();
const input2 = prompt("What's your name?");
alert(`Your name is ${input}`);
const input3 = prompt('Please enter your age:');
alert(`You are ${input} years old`);