Last active
May 30, 2017 04:12
-
-
Save velotio-tech/a4f579d0c43f33524feb712c033dfdea 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