Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get input in terminal nodejs

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

readline.question('Who are you?', name => {
  console.log(`Hey there ${name}!`);
  readline.close();
});
Comment

node command line input

process.stdin.on('data', (data) => {
	console.log(`You typed ${data}`);
})
Comment

input from terminal node js

// npm i readline-sync
import readlineSync from 'readline-sync';

const text = readlineSync.question('enter text:');

const password = readlineSync.question('password:', {
  hideEchoBack: true // The typed text on screen is hidden by `*` (default).
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: check palindrome javascript 
Javascript :: how to check consecutive characters in javascript 
Javascript :: angular decode url 
Javascript :: insert image in react 
Javascript :: jquery get all text inputs 
Javascript :: print table javascript 
Javascript :: reverse geocoding javascript map 
Javascript :: onchange not working input jquery 
Javascript :: javascript assert 
Javascript :: how to get object keys and values in javascript 
Javascript :: react native text span 
Javascript :: jquery on checkbox change 
Javascript :: hello word in js 
Javascript :: refresh page and run function after javascript 
Javascript :: Return certain fields with populate from mongoose 
Javascript :: Confirm the Ending 
Javascript :: toastr.js notification for laravel 
Javascript :: javascript add to array 
Javascript :: react native no android sdk found 
Javascript :: node fs exists 
Javascript :: redux template create react app 
Javascript :: javascript date methods 
Javascript :: js check if string is number 
Javascript :: redux devtools chrome 
Javascript :: req body express 
Javascript :: react is there a safe area view for android 
Javascript :: access to static file nodejs 
Javascript :: javascript class constructor 
Javascript :: how do you make a random array in javascript 
Javascript :: regex urls 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =