How is asynchronous code executed in Web API environment and Is Web API environment in itself an engine?
JS runtime is a container which includes all different pieces to execute JavaScript :- JS engine, Web API Environment, Callback Queue, Microtask Queue, Event Loop.
So every synchronous code is executed in JS engine that is Call Stack and every asynchronous code is executed in Web API environment (timeout, DOM, fetch).
How is asynchronous code executed in Web API environment?
How did JS runtime judge where should this line of code be executed, in CallStack or Web API environment? what I mean is that, did JS engine send the code to Web API environment for execution or what?
So, is Web API environment in itself an engine ( or sort of ) for asynchronous code ?