[JavaScript] confused about async/await even after reading docs
Posted by NeedleworkerLumpy907@reddit | learnprogramming | View on Reddit | 7 comments
I’ve read MDN and a few blog posts about async/await, but I still don’t “feel” how it actually pauses code.
I understand that it doesn’t block the whole program, but when I step through it mentally, I get lost.
What I tried:
* console.log before and after `await`
* reading about promises first
* searching “async await explained simply”
What I don’t get is:
Why does code *after* `await` sometimes run later, but variables still have the correct value?
Not asking for full example app, just want to understand what’s happening in my head wrong.
7 Comments
fixermark@reddit
peterlinddk@reddit
ucladurkel@reddit
paperic@reddit
aleques-itj@reddit
dont_touch_my_peepee@reddit
johnpeters42@reddit