“Input di Node JS” Kode Jawaban

Input di 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();
})
Poised Panda

Mendapatkan input pengguna di 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}`);
Blushing Beetle

cara mengambil input dari nodej pengguna

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

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

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

node js mendapatkan input dari konsol

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

Jawaban yang mirip dengan “Input di Node JS”

Pertanyaan yang mirip dengan “Input di Node JS”

Lebih banyak jawaban terkait untuk “Input di Node JS” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya