Skip to content

Instantly share code, notes, and snippets.

@pmogollons
Created December 11, 2018 12:39
Show Gist options
  • Save pmogollons/97e933d453866561bdc5d77642dbe3e0 to your computer and use it in GitHub Desktop.
Save pmogollons/97e933d453866561bdc5d77642dbe3e0 to your computer and use it in GitHub Desktop.
function startCallbackHell() {
callback1(params, (error, response) => {
if (error) {
// Do something with the error
} else {
callback2({ response }, (error, response) => {
if (error) {
// Do something with the error
} else {
callback3({ response }, (error, response) => {
if (error) {
// Do something with the error
} else {
callback4({ response }, (error, response) => {
if (error) {
// Do something with the error
} else {
callback5({ response }, (error, response) => {
if (error) {
// Do something with the error
} else {
...
}
});
}
});
}
});
}
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment