I am understanding how the js engine handles promises then I got this great article https://medium.com/@jitubutwal144/javascript-how-is-callback-execution-strategy-for-promises-different-than-dom-events-callback-73c0e9e203b1. This made me very much clear. But If we make an HTTP request inside the promise then when js see that promise object which contains Http request it adds its callback in the microtask queue and js call stack starts executing promise. It saw HTTP request and send's it to browser to make it. Now the browser is completed with it and add's http callback to task queue which calls resolve, request. According to its js engine first picks micro task but it cannot do anything with a microtask because its resultant callback is in the task queue. I am confused about how the js engine will handle it. Can anyone please help
Asked
Active
Viewed 79 times