JavaScript Runtime Flashcards

1
Q

What is the runtime in the browser?

A

Essentially a container which includes all the pieces necessary to execute javascript code

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

What is the engine?

A

The “heart” of the runtime, where code is actually executed and where objects are stored in memory

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

Where is code executed at runtime

A

On the call stack

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

Where are objects stored in memory?

A

On the heap

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

How many threads of execution does JavaScript use?

A

One

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

What are the DOM, Fetch API and Timers a collection of?

A

Web APIs provided to the engine, they are not part of javascript

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

What is the callback queue?

A

A data structure that holds the callback functions ready to be executed coming from events e.g. clicks, timers, data (fetch(), setTimeout() etc)

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

What does the event loop do?

A

Takes callbacks from the callback queue / microtasks queue and adds them to the call stack

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

Why is the event loop so important

A

It allows us to perform asynchronous javascript tasks

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

Where to image request happen at runtime?

A

In the Web API environment - if they were to run on the call stack they’d block it

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

Where does an event listener wait once its been registered by the runtime and where does it go to once it’s been called?

A

It waits in the web API and mo ves to the callback queue once called e.g. a click happens

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