event ∞ Flashcards

1
Q

What is the JavaScript Event Loop?

A

responsible for executing the code, collecting and processing events, and executing queued sub-tasks

one job: look at stack and task queue

if the stack is empty, pushes whatever is on the task queue

first in, first out (FIFO)

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

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

A

Handling I/O is typically performed via events and callbacks, so when the application is waiting for something like a database query to return or an api request to return, it can still process other things like user input

blocking: ‘stack is full and waiting for processes”
nonblocking:

event loop is what allows Node.js to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible

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

what separates javascript from other languages?

A

Prototypal Inheritance, how this works, closures, and the event loop

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

what’s critical for modern web dev?

A

asynchronous programming

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

process

A

node/web -> callback queue (FIFO) -> event loop -> call stack (LIFO)

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