Skip to content

Instantly share code, notes, and snippets.

@insanj
Created October 26, 2020 15:30
Show Gist options
  • Save insanj/9c2c21272ebe449bc8ca9a3a41428c50 to your computer and use it in GitHub Desktop.
Save insanj/9c2c21272ebe449bc8ca9a3a41428c50 to your computer and use it in GitHub Desktop.
fun with promises
function hello() {
return new Promise((resolve, reject) => {
const world = async function() {
return 'hello';
}
world().then(r =>
resolve(r)
).catch(e => {
reject(e);
})
});
}
hello().then(result => {
console.log(result);
}).catch(error => {
console.log(error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment