Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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();
})
Comment

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();
})
Comment

getting user input in node js

//Make sure you have Node and NPM installed
//Run "npm install prompt-sync" in the terminal
const prompt = require('prompt-sync')();

const name = prompt('What is your name?');
console.log(`Hey there ${name}`);
Comment

getting user input in node js

//Make sure you have Node and NPM installed
//Run "npm install prompt-sync" in the terminal
const prompt = require('prompt-sync')();

const name = prompt('What is your name?');
console.log(`Hey there ${name}`);
Comment

how to take input from user nodejs

const prompt = require("prompt-sync")();

const input = prompt("What is your name? ");

console.log(`Oh, so your name is ${input}`);
Comment

how to take input from user nodejs

const prompt = require("prompt-sync")();

const input = prompt("What is your name? ");

console.log(`Oh, so your name is ${input}`);
Comment

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);

--------------------------------------------------------------
Comment

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);

--------------------------------------------------------------
Comment

Nodejs user input

// Importing the module
const readline = require("readline-sync");
  
// Enter the number
let a = Number(readline.question());
let number = [];
for (let i = 0; i < a; ++i) {
  number.push(Number(readline.question()));
}
console.log(number);
Comment

Nodejs user input

// Importing the module
const readline = require("readline-sync");
  
// Enter the number
let a = Number(readline.question());
let number = [];
for (let i = 0; i < a; ++i) {
  number.push(Number(readline.question()));
}
console.log(number);
Comment

get user input Node js console

// first install prompt-sync:
// npm install prompt-sync

const prompt = require("prompt-sync")({ sigint: true });

const age = prompt("How old are you? ");
console.log(`You are ${age} years old.`);
Comment

get user input Node js console

// first install prompt-sync:
// npm install prompt-sync

const prompt = require("prompt-sync")({ sigint: true });

const age = prompt("How old are you? ");
console.log(`You are ${age} years old.`);
Comment

PREVIOUS NEXT
Code Example
Javascript :: reactjs install 
Javascript :: ngstyle background url angular 
Javascript :: js loop over array of objects extract value 
Javascript :: express receive post 
Javascript :: regex string case insensitive 
Javascript :: how to use svg in react js 
Javascript :: setinterval stop onditional stop 
Javascript :: disable mixed content via javascript 
Javascript :: how to get number of a specific element of an array 
Javascript :: javascript urlsearchparams to object 
Javascript :: placeholder in angular 9 select 
Javascript :: react native paper text input 
Javascript :: puppeteer mac m1 
Javascript :: java script remove last character from string 
Javascript :: enzyme-to-json 
Javascript :: javascript arithmetic operators 
Javascript :: for each of object 
Javascript :: create csv file javascript 
Javascript :: set dynamic route in link react js 
Javascript :: how to ssh into gke node 
Javascript :: js sort letters 
Javascript :: sort mongoose response 
Javascript :: moment compare time 
Javascript :: if cart empty shopify 
Javascript :: reload a child component in angular 
Javascript :: dot env react native 
Javascript :: boucle for in js 
Javascript :: close div when click outside angular 7 
Javascript :: html set textarea value 
Javascript :: kendo template multiselect default selected 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =