the-event-loop Flashcards

1
Q

What is the JavaScript Event Loop?

A

The event loop takes whatever is on the task queue and pushes it on the call stack, but only if and when the call stack is empty.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is difference between “blocking” and “non-blocking” with respect to how code is executed?

A

Blocking code means that there is a piece of code that is running and nothing else can happen. Until that piece of code is run, nothing else can run.
Non-blocking code is when a function can be run on the side while the rest of the code is processing or executing. setTimeout() is an example of non-blocking code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly