Last active
June 17, 2020 05:04
-
-
Save Ratstail91/4f340dc087073f0974f8035290960c05 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
//10x programmers (this shitpost took a fucking hour, wtf): | |
const rl = require('readline').createInterface({ | |
input: process.stdin, output: process.stdout | |
}); | |
let table = {}; | |
const q = (prompt, key) => () => new Promise(res => rl.question(prompt, answer => res(Object.assign(table, { [key]: answer })) )); | |
Promise.resolve() | |
.then(q('what is your name?', 'name')) | |
.then(q('what is your job?', 'job')) | |
.then(q('what is your age?', 'age')) | |
.then(() => console.log(`You are ${table.name} who is a ${table.job} and is ${table.age} years old.`)) | |
.then(() => rl.close()) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think I'm starring this for the effort