Reference · 50 terms
Glossary
Every short form used across the series. Inside a lesson, hover or tap any dotted term to see the same entry in place.
Execution model
- call stackCall stack
- The stack of execution contexts. The one on top is running; a function call pushes a new one, return pops it. Also called the execution context stack, program stack or runtime stack.Lesson 2 →
- code componentCode component / thread of execution
- The half of an execution context that runs your code one line at a time, top to bottom.Lesson 1 →
- code execution phaseCode execution phase
- Phase 2. The engine goes back to line 1 and runs the code for real, replacing each undefined placeholder with its actual value.Lesson 1 →
- execution contextExecution context
- The container the engine builds before running any code: a memory half (variables and functions) and a code half (the line currently running). Every function call gets its own.Lesson 1 →
- GECGlobal Execution Context
- The very first execution context, created when the file starts and destroyed only when the program ends. It sits at the bottom of the call stack the whole time.Lesson 1 →
- hoistingHoisting
- The effect of the memory creation phase: names exist before the line that declares them. Functions are fully usable early; var reads as undefined; let and const throw until their line runs.Lesson 3 →
- invocationFunction invocation
- Calling a function with parentheses: square(4). It creates a brand-new execution context and pushes it onto the call stack.Lesson 1 →
- loosely typedLoosely (dynamically) typed
- A variable has no fixed type: the same slot can hold a number, then a string, then a function. The type belongs to the value, not the variable.Lesson 6 →
- memory componentMemory component / variable environment
- The half of an execution context that stores every variable and function as a key → value pair. Filled completely before any code runs.Lesson 1 →
- memory creation phaseMemory creation phase
- Phase 1 of every execution context. The engine scans the code without running it: every var gets undefined, every function declaration gets its whole body.Lesson 1 →
- not definedReferenceError: x is not defined
- The name was never given any memory at all. Different from undefined, which means the slot exists but has no value yet.Lesson 6 →
- single-threadedSingle-threaded
- JavaScript has exactly one call stack, so it can run exactly one line at a time. Everything that looks parallel is queued around that one thread.Lesson 1 →
- synchronousSynchronous
- Each line finishes before the next one starts. The engine never skips ahead; it can only wait or move on to the next line.Lesson 1 →
- windowGlobal object (window in browsers, globalThis everywhere)
- The object the engine creates alongside the global execution context. Top-level var and function declarations become its properties; at top level, this points to it.Lesson 5 →
Scope
- block scopeBlock scope
- Anything inside a pair of curly braces { }. let and const belong to the block they are declared in; var ignores blocks and belongs to the function.Lesson 9 →
- closureClosure
- A function bundled with the lexical environment it was written in. It keeps that environment alive even after the outer function has returned.Lesson 10 →
- lexical environmentLexical environment
- A context's own memory plus a reference to the memory of the context it was written inside. “Lexical” means “decided by where the code sits in the file”.Lesson 7 →
- scopeScope
- Where a variable can be seen from. A function can see its own variables and everything its parents can see, but not the other way round.Lesson 7 →
- scope chainScope chain
- The path the engine walks to find a variable: this context's memory, then its parent's, then the parent's parent, until it hits the global one and then null.Lesson 7 →
- shadowingVariable shadowing
- Declaring a variable in an inner scope with the same name as one outside. The inner one hides the outer one until the inner scope ends.Lesson 9 →
- TDZTemporal Dead Zone
- The stretch between the start of a scope and the line that declares a let or const. The name is hoisted but reading it throws a ReferenceError.Lesson 8 →
Functions
- argumentArgument
- The value you actually pass when calling: square(4). It is copied into the matching parameter.Lesson 1 →
- arrow functionArrow function
- The () => { … } syntax. Shorter, and it does not get its own this — it uses the this of the code around it.Lesson 12 →
- callbackCallback function
- A function you hand to someone else to call later — when a timer fires, a click happens or a request finishes.Lesson 12 →
- event listenerEvent listener
- A callback attached to an element with addEventListener. It holds a closure over its surroundings, which is why forgetting to remove one can leak memory.Lesson 12 →
- first-class functionsFirst-class functions
- Functions are values: they can be stored in variables, passed as arguments and returned from other functions, like any number or string.Lesson 12 →
- function declarationFunction declaration
- function square() { … } written as a statement. Fully hoisted: the whole body is in memory before line 1 runs.Lesson 1 →
- function expressionFunction expression
- A function stored in a variable: const square = function () { … }. Hoisted like a variable, not like a function — calling it early fails.Lesson 3 →
- higher-order functionHigher-order function
- A function that takes another function as an argument or returns one. setTimeout, addEventListener and array.map are all higher-order.Lesson 12 →
- parameterParameter
- The name in the function definition (num in function square(num)). Just a local variable of that call's execution context, filled from the argument.Lesson 1 →
Async
- callback queueCallback (task) queue
- Where finished timers and events wait for the call stack to empty. The event loop takes from it one callback at a time.Lesson 14 →
- event loopEvent loop
- A tiny loop that watches the call stack and, whenever it is empty, moves the next waiting callback from a queue onto the stack.Lesson 14 →
- microtask queueMicrotask queue
- A higher-priority queue for promise callbacks. It is fully drained before the event loop takes anything from the callback queue.Lesson 14 →
- promisePromise
- An object standing in for a value that will arrive later. Its .then callbacks go to the microtask queue.Lesson 14 →
- setTimeoutsetTimeout(callback, ms)
- Ask the browser to run a callback after at least ms milliseconds. “At least”, because the callback still has to wait for an empty call stack.Lesson 11 →
- starvationStarvation
- When microtasks keep adding more microtasks, so the callback queue never gets a turn and timers and clicks stall.Lesson 14 →
- Web APIsWeb APIs (browser-provided)
- setTimeout, fetch, DOM events, localStorage — features the browser gives JavaScript that are not part of the language itself. Node provides its own equivalents.Lesson 14 →
Engine
- ASTAbstract Syntax Tree
- The tree the parser builds from your source text before anything runs. Every token becomes a node.Lesson 13 →
- ECMAScriptECMAScript specification
- The written standard that defines the JavaScript language. Engines like V8 implement it; browsers add the Web APIs on top.Lesson 13 →
- garbage collectionGarbage collection
- The engine automatically frees memory for anything nothing can reach any more. V8's collector is called Orinoco.Lesson 13 →
- IgnitionIgnition (V8's interpreter)
- The part of V8 that turns your code into bytecode and starts running it straight away.Lesson 13 →
- JITJust-In-Time compilation
- Start by interpreting code so it runs immediately, then compile the hot parts to fast machine code while the program is running.Lesson 13 →
- memory heapMemory heap
- Where objects, arrays and function bodies live. Unstructured, unlike the stack; cleaned by the garbage collector.Lesson 13 →
- TurboFanTurboFan (V8's optimising compiler)
- The part of V8 that watches which functions run often and compiles those into optimised machine code.Lesson 13 →
- V8V8 JavaScript engine
- Google's engine, used by Chrome and Node.js. It parses, interprets and compiles your JavaScript into machine code.Lesson 13 →
Tools
- breakpointBreakpoint
- A marker on a line that pauses execution when reached, so you can inspect memory and the call stack at that exact moment.Lesson 1 →
- debuggerdebugger statement
- Writing debugger; in code acts like a breakpoint whenever DevTools or the Node inspector is open.Lesson 1 →
- DevToolsChrome DevTools
- The panel behind F12. The Sources tab shows the call stack and every scope's variables while paused on a breakpoint.Lesson 1 →
- Node.jsNode.js
- V8 plus a set of server-side APIs (files, network) so JavaScript can run outside a browser.Lesson 1 →
- REPLRead–Eval–Print Loop
- The interactive prompt you get from typing node with no file: type a line, see the result, repeat.Lesson 1 →