Last active
September 21, 2021 15:38
-
-
Save stoneboyindc/ee2857b550ca061285bfa9d77ffde087 to your computer and use it in GitHub Desktop.
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 { welcome, goodbye, tell } = require("../utils/fortune-teller"); | |
function getFortune(question) { | |
tell(question).then(msg => { | |
console.log(`Your question was: ${question}`); | |
console.log(`Your fortune is: ${msg}`)}) | |
.catch(err => console.log('There was an error: A question is required...')); | |
} | |
function fullSession(question) { | |
welcome().then(msg => console.log(msg)) | |
getFortune(question) | |
if (!question) { | |
return; | |
} | |
goodbye().then(msg => console.log(msg)); | |
} | |
module.exports = { getFortune, fullSession }; |
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 { welcome, goodbye, tell } = require("../utils/fortune-teller"); | |
async function getFortune(question) { | |
try{ | |
let response = await tell(question) | |
console.log(`Your question was: ${question}`); | |
console.log(`Your fortune is: ${response}`); | |
} | |
catch(err){ | |
console.log(`There was an error: ${err}`); | |
} | |
} | |
async function fullSession(question) { | |
let msg = await welcome(); | |
console.log(msg); | |
msg = await getFortune(question); | |
console.log(msg) | |
msg = await goodbye(); | |
console.log(msg); | |
} | |
module.exports = { getFortune, fullSession }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment