JavaScript Engine Flashcards

0
Q

Engine:

What are the 3 basic tasks a JavaScript compiler completes before the code executes?

A

Tokenization: breaking up a string of characters into meaning pieces.

Parsing: arranging the tokens into a usable order called an abstract syntax tree.

Code-Generation: creating usable code and if possible performing optimization.

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

Engine:
True/False

JavaScript is not complied because it is “dynamic.”

A

False

JavaScript is complied before it executes even though it is considered an “interpreted” language.

Understanding the steps the compiler takes is important to understanding how JavaScript works.

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

Engine:

How will automatic semicolon insertion (ASI) modify this statement?

return
{myObject: “some value”}

A

return;
{myObject: “some value”};

So this statement will alway return “undefined” and the object will be ignored.

This happens because a new line follows the keyword “return.” This rule also applies when a new line follows continue, break and throw.

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

Engine:
True/False

The JavaScript complier is called a JIT compiler.

A

False.

The JIT or just in time compiler is an optimization technique used by many compilers to precompile code. It is not the actual compiler.

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