Created
June 4, 2020 04:21
-
-
Save harrisonmalone/959bede46562c9c0b4d4168b8ac01823 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 readline = require("readline-sync") | |
const chalk = require("chalk") | |
const colors = ['red', 'blue', 'green', 'magenta'] | |
console.log("hi, whats your name?") | |
const name = readline.question("> ") | |
console.log("whats your favorite color?") | |
const index = readline.keyInSelect(colors, 'Which color?'); | |
if (index === -1) { | |
process.exit() | |
} else { | |
console.log(chalk[colors[index]](name)) | |
} |
This file contains hidden or 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
{ | |
"name": "node-intro", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"chalk": "^4.0.0", | |
"lodash": "^4.17.15", | |
"moment": "^2.26.0", | |
"node-fetch": "^2.6.0", | |
"readline-sync": "^1.4.10" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment