Skip to content

Instantly share code, notes, and snippets.

@pqt
Created January 8, 2019 13:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pqt/883216dfe290585ac4b839f8209949b7 to your computer and use it in GitHub Desktop.
Save pqt/883216dfe290585ac4b839f8209949b7 to your computer and use it in GitHub Desktop.
// https://i.imgur.com/V0PNlIZ.png
(async () => {
const a = await getData();
const b = await getMoreData(a);
const c = await getMoreData(b);
const d = await getMoreData(c);
const e = await getMoreData(d);
console.log(e)
})();
// https://i.imgur.com/3vrblsw.png
getData(a => {
getMoreData(a, b => {
getMoreData(b, c => {
getMoreData(c, d => {
getMoreData(d, e => {
console.log(e)
})
})
})
})
})
// https://i.imgur.com/rxyblDT.png
getData()
.then(a => getMoreData(a))
.then(b => getMoreData(b))
.then(c => getMoreData(c))
.then(d => getMoreData(d))
.then(e => console.log(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment