Thoughts on Promises
I’ve always found promises rather confusing. After recapping it for the nth time this morning, I would like to detail here my main takeaways so that I can finally commit them to memory. Recap on Promises Firstly, to understand promises, you first have to understand threading. Javascript is single-threaded, meaning that all code execute line by line, one after another. When you create a promise, you’re essentially creating another thread that is added to the event queue and importantly, executed after your main code block. ...