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

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

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

PREVIOUS NEXT
Code Example
Javascript :: js hex 
Javascript :: javascript stop youtube video 
Javascript :: webview javascript enabled 
Javascript :: js how to get selectpicker value 
Javascript :: delayed in js 
Javascript :: array alphabet 
Javascript :: js int to string 
Javascript :: jquery doc ready 
Javascript :: javascript alerter 
Javascript :: Iterating through an Object 
Javascript :: javacript open url in new tab 
Javascript :: jquery check input 
Javascript :: jquery get attribute value of parent element 
Javascript :: html get selected option javascript 
Javascript :: document.ready shorthand 
Javascript :: jquery insert option into select 
Javascript :: dotenv jest 
Javascript :: vuejs localstorage add value 
Javascript :: validators.pattern angular number 
Javascript :: jquery set style background image 
Javascript :: regex 24 hour time validation regex 
Javascript :: text to Speech in javascript code 
Javascript :: element without a particular class jquery 
Javascript :: how send to another page by router in vuejs 
Javascript :: scrolltop top to bottom body get count 
Javascript :: express send raw html 
Javascript :: js download json 
Javascript :: js conditional object property 
Javascript :: javascript numero al cuadrado 
Javascript :: get distance of element from top of page javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =