Event Loop, Promises, Task Queues and Callstack

Recently reading Event Loop, Promises, Task Queues, Call Stack, and Web APIs in Js. Just jotting down some notes. JavaScript Js is single-threaded, when handling long-running tasks it could block the main thread, causing the UI to freeze. To avoid this, Js uses the following mechanisms to handle async tasks. Call Stack When a function is called, it is pushed onto the call stack. When the function returns, it is popped out of the stack....

June 6, 2024 · 4 min