Last active
December 19, 2018 07:47
-
-
Save bitbonsai/d41424e7aff87c32a048eae943fe7836 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
// or even better: https://blog.risingstack.com/mastering-async-await-in-nodejs/ | |
// https://github.com/iagodahlem/clima-cli/blob/master/src/utils/weather.js | |
// https://github.com/axios/axios | |
async function f() { | |
let result = await e(1500); | |
let output = await d(result); | |
console.log(output); | |
} | |
async function e (delay) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(c()); | |
}, delay || 1000); | |
}) | |
} | |
function c () { | |
return 'a ordem do dia é: ' | |
} | |
function d (str) { | |
return str + 'promessas' | |
} | |
f(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment