input in node js
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question('who are you: ', name => {
console.log(`hello, hi there ${name}`);
readline.close();
})
input in node js
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question('who are you: ', name => {
console.log(`hello, hi there ${name}`);
readline.close();
})
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);
});
node js ask for user input
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("What is your name ? ", function(name) {
rl.question("Where do you live ? ", function(country) {
console.log(`${name}, is a citizen of ${country}`);
rl.close();
});
});
rl.on("close", function() {
console.log("\nBYE BYE !!!");
process.exit(0);
});
user input node javascript
const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout}); readline.question('Who are you?', name => { console.log(`Hey there ${name}!`); readline.close();});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us