The Event Loop Flashcards
1
Q
What is the JavaScript Event Loop?
A
The JavaScript event loop allows lines of code to be executed asynchronously using setTimeout and setIntervals
It is composed of a Stack, web API’s, and a Task Queue
When the stack is cleared it pushes the callbacks in the queue to the stack
2
Q
What is different between ‘blocking’ and ‘non-blocking’ with respect to how code is executed?
A
Blocking happens when tasks are in the stack, code cannot execute until it is at the top of the stack.
Any code that is sitting on top of the stack until it is done is ‘blocking’
Non-blocking takes place at the end of processing the blocking code