Javascript Foundation Flashcards

1
Q

What is an Interpreter?

A

It’s what runs the code line by line.

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

What is a Compiler?

A

A compiler translates code in one language to another language.

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

What is Babel?

A

Babel is a Javascript compiler that takes your modern JS code and returns browser compatible JS (older JS code).

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

What is Typescript?

A

Typescript is a superset of Javascript that compiles down to Javascript.

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

What is a JIT Compiler?

A

Git Compiler is an engine that merges the interpreter and compiler together.

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

What is Call Stack?

A

Call Stack is how the interpreter keeps track of the of its place in a script that has multiple functions. It keeps track of what function is currently being run and what functions are called from within that function.

Follows the first in the first out rule.

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

What is Memory Heap?

A

Memory Heap is where the engine allocates memory to store data.

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

What is Stack Overflow?

A

Is when the Call Stack has grown too large.

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

What is Garbage Collection?

A

Garbage Collections is when the Javascript engine frees up allocated memory from objects no longer being used.

This doesn’t mean you shouldn’t care about memory management.

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

What are the 3 most common ways to create a memory leak?

A

Global Variables

Event Listeners.

Set Interval.

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

Javascript is a single-threaded language. What does single-threaded mean?

A

Single threaded means only one set of instructions is executed at a time.

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

What is Javascript Runtime?

A

Javascript Runtime is the environment that houses the WebAPI, Callback Queue, Event Loop, and Engine.

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

What is the Execution Context?

A

The ‘environment’ a function executes in.

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

What is the Lexical Environment?

A

Where in the file your code is written in relation to the other code.

Think of like each function or code has its own world / its own lexical environment.

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

What kind of function is in the picture?

A

Function Expression.

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

What kind of function is in the picture?

A

Function Declaration.

17
Q

What is Hoisting?

A

Hosting is when variables with the keyword var and function declarations are moved to the top of their scope before code execution.

let and const do not get hoisted.

Variables with var are only partially hoisted. Meaning the variable gets hoisted but not the value of the variable.

18
Q

What is Function Invocation?

A

When you run the function.

19
Q

Explain undefined.

A

undefined means, Yes we have this variable but it is not assigned anything.

20
Q

Explain Reference Error.

A

Reference Error means this is completely undeclared. Scope chain can’t find anything.

21
Q

What is “use strict”?

A

The purpose of “use strict” is to indicate that the code should be executed in “strict mode”. With strict mode, you can not, for example, use undeclared variables.

22
Q

What is the this keyword?

A

this is the object that the function is a property of.

23
Q

If there is no object for this to refer to then what does it default to?

A

The window object.