High Level Concepts Flashcards
(35 cards)
First Class Functions
Functions are treated as variables
Single Threaded
One command is processed at a time
Event loop
Takes long running tasks, executes them in the background, and puts them back in the main thread once they are completed
Compilation
Entire codebase is converted into machine code at once, and written to a binary file that can be executed by a computer
Interpretation
Interpreter runs through the source code and executes it line by line
Just-in-time Compilation
Entire code is converted into machine code at once, then executed immediately
Web API’s
Functionalities provided to the engine, available on the window object. DOM, Times, Fetch…
Top-level code
All code outside of functions
Global Execution Context
Default execution context stated when a file is loaded in the browser. All top-level code is executed here
Execution context
The environment in which the javascript code is executed
Call Stack
Place where execution contexts get stacked on top of each other, to keep track of where we are in the execution
What Makes Up An Execution Context
- Variable environment
- Scope Chain
- “this” keyword
Lexical Scoping
Defines how variable names are resolved in nested functions
Scope
The accessibility or visibility of variables
3 Types of Scope
Global, function and block
Scope Chain
Used to resolve the value of variable names in javascript.
Hoisting
Makes some types of variables accessible/usable in the code before they are declared
Types of variables that are hoisted
function declarations, variables declared with var
Temporal Dead Zone
Region of scope where a variable is defined but cannot be used
Types of variables that are not hoisted
let and const variables, arrow expressions
This keyword
Special variable created in every execution context. Takes the value of the owner.
Primitive types
Number, string, boolean, null, undefined, symbol, bigint
Remainder operator
Returns the remainder left over when one operand is divided by a second operand
References the DOM object that dispatched an event
Target