Answers for "node javascript read from console"

0

node js get input from console

--------------- easiest method I found---------------------------
  
Run npm install prompt-sync in the terminal
const prompt = require('prompt-sync')();

var name = prompt('what is your name?');

console.log(name);

--------------------------------------------------------------
Posted by: Guest on March-25-2022
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 "node javascript read from console"

Code answers related to "Javascript"

Browse Popular Code Answers by Language