How can I access user input in JavaScript in Node.js by computer filing?
Answers
Answered by
6
Answer:
In JavaScript, we can get user input like this: var name = window. prompt("Enter your name: "); alert("Your name is " + name); The code above simply prompts the user for information, and the prints out what they entered in
Answered by
6
Answer:
Once you've loaded the prompt-sync module and called it, using it to retrieve user input is relatively straightforward:
▪const prompt = require('prompt-sync')();
▪const name = prompt('What is your name? ');
▪console. log(`Hey there ${name}`);
HOPE IT HELPS YOU DEAR
☺☺☺☺☺
Similar questions