Created
March 9, 2022 10:53
-
-
Save lejonmanen/1759865308aa7ba08b913515be3c8436 to your computer and use it in GitHub Desktop.
Node script: how to get input from user in the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const prompt = require('prompt-sync')() | |
/* | |
Before running this code, make sure to create an npm project: | |
npm init -y | |
npm install prompt-sync | |
node input.js | |
*/ | |
// How to get input from user | |
let x = prompt('What is your name? ') | |
console.log(`Welcome ${x}!`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment