JavaScript Engine Flashcards

1
Q

Engine

A

A JavaScript Engine is a computer program that you give JavaScript code to and it tells the computer how to execute it. Basically a translator for the computer between JavaScript and a language that the computer understands.

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

Parser

A

Process of analyzing the source code, checking for errors, and breaking it up into parts.

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

AST

A

A tree graph of the source code.

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

Interpreter

A

An interpreter directly executes each line of code line by line, without requiring them to be compiled into a machine language program.

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

Compiler

A

First it converts the code into a code that the computer can understand, and then it runs the code
e.g. Babel or TypeScript.

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

JIT Compiler

A

In modern engines, the interpreter starts reading the code line by line while
the profiler watches for frequently used code and flags then passes is to the compiler to be optimized. In the end, the JavaScript engine takes the bytecode the interpreter outputs and mixes in the optimized code the compiler outputs and then gives that to the computer. This is called “Just in Time” or JIT Compiler.

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

Differences of using Interpreters and Compilers

A

Interpreters: Fast to start running, because the code executes right away. Does not optimize code, if you have a function that returns the same result every time, the interpreter does not optimize this code.
Compiler: Slower to start running. Faster when starts running because code can be optimized.

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

Memory Heap

A

A place to allocate, use, and remove memory as needed.

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

Call Stack

A

Keeps tack of where we are in the code, so we can run the program in order.

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

Stack Overflow

A

Happens when you keep calling functions that are nested inside each other. Maximum call stack size exceeded.

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

Garbage Collection

A

JavaScript is a garbage collected language. If you allocate memory inside of a function, JavaScript will automatically remove it from the memory heap when the function is done being called.

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