Fernarzt interview question

How does Javascript works on a single thread even though you can use SetTimeout kind of methods.

Interview Answer

Anonymous

30 Aug 2022

As long as you dont block the main thread, there are APIs(Web API, nodejs API) to handle those async processes in the background. Those APIs run executions at parallel and put the output on queue. When main thread runs all the processes, event loop pushes those outputs to main thread.