Created
July 1, 2020 11:04
-
-
Save velotiotech/d641659474e82ed42f7936445eba5356 to your computer and use it in GitHub Desktop.
Node.js Async Hell
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
foo(arg, (err, val) => { | |
if (err) { | |
console.log(err); | |
} else { | |
val += 1; | |
bar(val, (err1, val1) => { | |
if (err) { | |
console.log(err1); | |
} else { | |
val1 += 2; | |
baz(val1, (err2, result) => { | |
if (err2) { | |
console.log(err2); | |
} else { | |
result += 3; | |
console.log(result); // 6 | |
} | |
}); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment