“Получение ввода пользователя в узле JS” Ответ

Ввод в узле 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();
})
Poised Panda

Получите ввод в терминальные узлы

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

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

Получение ввода пользователя в узле 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}`);
Blushing Beetle

Узел JS Получите вход из консоли

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

--------------------------------------------------------------
Kriss Sachintha

Ответы похожие на “Получение ввода пользователя в узле JS”

Вопросы похожие на “Получение ввода пользователя в узле JS”

Больше похожих ответов на “Получение ввода пользователя в узле JS” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования