JavaScript Engine Flashcards
Engine:
What are the 3 basic tasks a JavaScript compiler completes before the code executes?
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.
Engine:
True/False
JavaScript is not complied because it is “dynamic.”
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.
Engine:
How will automatic semicolon insertion (ASI) modify this statement?
return
{myObject: “some value”}
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.
Engine:
True/False
The JavaScript complier is called a JIT compiler.
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.