- Ran npm init to create initial draft of package.json.
- Ran node -v > .nvmrc to create .nvmrc. This ensures the desired version (In my case, system's default : v21.7.1) of NodeJs is used. Run nvm use to take effect.
- Installed following packages using npm install
- prompt-sync (For input prompts).
// sigint (Signal Interrupt) to true allows user to interrupt (exit) the program flow (using Ctrl+C) const jsPrompt = require('prompt-sync')({sigint: true}); let tests = jsPrompt("Enter number:") console.log(tests);NOTE: NodeJS has in-built functions for the same. They're too wordy.
const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout }); readline.question('Number?', num => { console.log(`Number entered ${num}!`); readline.close(); }); - Run code on Terminal
node <path to JS file>
-
Notifications
You must be signed in to change notification settings - Fork 0
amit1petkar/JavaScript
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published