Answers for "console input in js"

0

input javascript console

const input = prompt("What's your name?"); //optional params
console.log(input);
Posted by: Guest on September-04-2021
1

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);
});
Posted by: Guest on December-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language