Answers for "readline node js prompt"

1

readline node js

readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
})

readline.on("line", (line) => {
    if (line === "") {
        // Code
    }
    else if (line === "") {
        // Code
    }
})
Posted by: Guest on July-22-2021
0

node terminal readline console

before executing the command node in terminal you have to install
  :~$ npm install prompt-sync
if you havent already.
then inside node
  >const prompt = require('prompt-sync')();
  >name = prompt('What is your name? '); michael
  >console.log(`Hey there ${name}`);
Hey there michael
Posted by: Guest on August-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language