3 ms·
async/await is one of those very C++-ish features, though, due to how it's implemented. Understanding ES5 async callbacks requires very little conceptual under
by mkozlows 11y ago
async/await is one of those very C++-ish features, though, due to how it's implemented.
Understanding ES5 async callbacks requires very little conceptual understanding -- you need to understand run-to-completion and the event loop (and I guess the idea of higher-order functions), but otherwise it's straightforward.
Understanding ES2016 async/await keywords require you to understand all of that, plus ES2015 promises, ES2015 generators, and how they're all orchestrated together to implement async/await. The code looks simpler, but understanding what's really happening is a lot harder.
- tracker1 11y agoTrue enough... I've been using async/await for about 6-8 months now via babeljs, and tbh trying to explain it to people so they understand how it really works is a bit painful... a lot of people don't understand that an async function is simply a promise wrapper around a generator yeilding promise-friendly values. It's kind of important to understand promises to use await/async affectively. I love the easier to read/follow code though.