←back to thread

123 points mooreds | 1 comments | | HN request time: 0.208s | source
Show context
lolive ◴[] No.45213787[source]
I am teaching asynchronous programming in typescript to junior developpers. And i find really tricky to tell them that async and await do MAJOR magic behind their back to make their code readable as synchronous code.

And then, I need to detail very precisely what "Promise.all()" (and "return") really mean in the context of async/await. Which is something that (I feel) could have been abstracted away during the async/await syntax definition, and make the full magic much more natural.

replies(3): >>45213797 #>>45213808 #>>45213970 #
swid ◴[] No.45213970[source]
Async/await themselves are not that much magic really, it's a bit of syntactic sugar over promise chains. Of course, understanding promises is its own bag.

ChatGPT explanation: https://chatgpt.com/share/68c30421-be3c-8011-8431-8f3385a654...

replies(2): >>45214047 #>>45214087 #
1. lolive ◴[] No.45214087[source]
During my interviews, may be I should ask them to read and understand this:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

prior to any dev they plan to do in JS/TS.

PS: 10 bucks that none of them would stay.