the-event-loop Flashcards

1
Q

What is the JavaScript event loop?

A

The event loop is one of the four major concepts that sets JavaScript apart from many other languages. (Prototypal inheritance, how ‘this’ works, closures, and the event loop). Understanding how asynchronous programming works is absolutely critical to modern Web development and especially programming in JavaScript. Takes a task that is queued, throws it into the call stack // web apis

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

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

A
  • Blocking - code that is slow (network requests…) prevents anything else happening.. Synchronous processes. Synchronous code runs in the JavaScript engine to completion. Starts on the call stack and runs to completion on the call stack. Prevents anything new from being pulled off from the event queue.
  • Non-blocking - code that is faster. Asynchronous processes. This type of code goes through the whole cycle.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly