140 terms across 10 categories
async marks a function that returns a promise. await pauses that function until a promise settles, then resumes with the value or throws the rejection.
SharedArrayBuffer is a block of memory two agents can see at once. Atomics provides reads, writes, waits, and notifies on that memory that cannot tear and that establish ordering.
The call stack is the engine's list of function frames that are currently running. The top frame is the function executing now; when it returns, the frame below resumes.
Async errors are rejected promises and exceptions thrown after an await. You handle them with try/catch around await, or with .catch on a promise chain — and you must attach one or the rejection is unhandled.
The event loop is the host's scheduler: it waits for the call stack to empty, drains all pending microtasks, then runs one queued task. It is what lets single-threaded JavaScript handle timers, clicks and network replies without blocking.
Microtasks are jobs that run after the current call stack empties and before the next macrotask (or paint). Promise reactions, queueMicrotask, and await continuations are microtasks.
worker_threads is Node's API for extra JavaScript threads in one process. Each worker has its own V8 isolate and event loop; you share work with messages, or with SharedArrayBuffer.
Promise combinators wait on several promises at once. all, allSettled, race, and any differ in when they settle and whether one failure aborts the group.
A promise is an object for a value that is not ready yet. It starts pending, then fulfills or rejects once, and you attach reactions with then, catch, and finally.
The task queue (macrotask queue) holds work the event loop runs one at a time: timers, I/O callbacks, UI events. After each task, the engine drains all microtasks before taking the next task.
A web worker is a browser thread that runs a script without access to the DOM. You talk to it with messages; heavy CPU work can stay off the page's event loop.
Three methods that every function inherits. call and apply invoke a function with a this value you choose; bind returns a new function with that this locked in permanently.
let, const, and var all declare variables, but they differ in scope, in what happens if you read them too early, and in whether the name can be reassigned or redeclared. Modern code uses const by default and let when the value must change.
this is a value passed into a function every time it is called. In most JavaScript functions it is decided by how the function is called, not by where it was written.
typeof returns a string naming a value's type. instanceof asks whether an object has a given constructor's prototype on its prototype chain. They answer different questions and both have traps.
An arrow function is a compact function expression written with =>. It does not have its own this, arguments, or super, and it cannot be used as a constructor.
BigInt is a primitive for integers of arbitrary size. You write it with an n suffix (9007199254740993n) or create it with BigInt(value). It does not mix with number in arithmetic.
A callback is a function you hand to another function so that it can be called later. It is the oldest way JavaScript expresses "do this when that finishes".
A closure is a function plus the lexical environment it was created in. The function can read and write outer variables even after the outer function has returned.
Two module systems in the same language. CommonJS uses require and module.exports and loads synchronously; ES Modules use import and export, are statically analysable, and load asynchronously.
Conditionals choose which code runs by testing a value. JavaScript treats many values as true or false, then takes the matching if, else if, or ternary branch.
JavaScript has eight types: the seven primitives — string, number, boolean, null, undefined, symbol, bigint — plus object, which covers everything else including arrays and functions. Values carry types; variables do not.
A default parameter fills in a value when the caller omits that argument or passes undefined. The default is an expression, evaluated at call time, from left to right.
Syntax that pulls values out of an object or array and assigns them to variables in one statement. The pattern on the left mirrors the shape of the data on the right.
ECMAScript is the written standard that defines the JavaScript language: its syntax, its types, and its built-in objects. JavaScript is the name everyone uses for the language that engines implement from that standard.
Equality in JavaScript is several operations: loose ==, strict ===, Object.is, and user-defined comparisons. They disagree about NaN, -0, and whether "1" equals 1.
A function declaration is a statement that creates a named function and hoists it. A function expression produces a function value as part of another expression, and that value exists only after the line runs.
A function is a reusable body of code you can call with arguments. In JavaScript, functions are values: you can store them, pass them, and return them from other functions.
Hoisting is the engine creating a scope's bindings before any line of that scope runs. var and function declarations are usable early; let and const exist but throw until their line initialises them.
An iterable is an object you can walk with for...of, spread, and Array.from. A generator is a function that returns an iterator and can pause with yield.
JSON is a text format for objects, arrays, strings, numbers, booleans, and null. JSON.stringify turns a JavaScript value into that text; JSON.parse turns the text back into values.
A lexical environment is the specification's model of a scope: a map of names to values, plus a link to the outer environment. Closures, hoisting, and this resolution are defined in terms of these environments.
Loops repeat a body until a condition fails. JavaScript has for, while, do...while, for...of over iterables, and for...in over object keys.
A module is a single file with its own scope that explicitly declares what it exposes with export and what it needs with import. Nothing is shared unless it is exported.
The ?? operator returns its right-hand side only when the left-hand side is null or undefined. Every other value, including 0, "" and false, is passed through.
Operators are the built-in symbols that combine or transform values: arithmetic, comparison, logical, bitwise, assignment, and a handful of keyword operators such as typeof and in. Each one has a precedence, an associativity, and its own coercion rules.
The ?. operator reads a property, index, or method call and returns undefined instead of throwing when the value on the left is null or undefined.
Primitives are immutable single values copied by value and compared by content. Objects are mutable containers held by reference, copied as references, and compared by identity. Nearly every "why did my data change?" bug comes from that difference.
A rest parameter collects the remaining arguments of a call into a real array. It is written as ...name on the last parameter of a function.
Scope is the region of code where a name can be used. JavaScript has module, function, and block scopes, and a name resolves by walking outward from the innermost one.
The same three dots with opposite jobs. Spread expands a collection into individual items; rest gathers individual items into one array or object.
Strict equality (=== and !==) compares two values without converting either one. If the types differ, the result is false. Same type, same value, same object reference.
Strict mode is a restricted variant of JavaScript that turns silent mistakes into errors and changes a few language rules, most visibly around this, arguments, and undeclared assignments.
switch compares one value against a list of case labels using strict equality, then runs the matching arm. Without break or return, execution falls through into the next case.
A symbol is a primitive unique key. Two symbols are never equal, even if their descriptions match, which makes them safe as property names that will not collide with ordinary strings.
Strings written with backticks instead of quotes. They can embed expressions with ${...}, span multiple lines, and be processed by a tag function.
The Temporal Dead Zone is the stretch of time between entering a scope and executing a let, const, or class declaration inside it. The name already exists during that window, but reading or writing it throws a ReferenceError.
Type coercion is the engine converting a value from one type to another because an operator or built-in asked for it. Some conversions are explicit (Number(x)); most of the surprising ones are implicit.
A variable is a name bound to a value. In JavaScript you create one with let, const, or var, and the keyword you choose decides where the name is visible and whether it can be reassigned.
fetch is the standard function for HTTP in browsers and Node. It returns a promise for a Response. Network failure rejects; HTTP 404 does not.
Content Security Policy is an HTTP header (or ``) that tells the browser which scripts, styles, images, and connections a page may use. It is the main defence-in-depth against XSS.
Cookies are small pieces of data the browser sends on matching HTTP requests. localStorage is a larger origin-scoped key/value store that JavaScript reads and writes and that is not sent automatically with every request.
CORS (Cross-Origin Resource Sharing) is the browser rule that lets a page on origin A read a response from origin B only if B's headers allow it. It is a server opt-in, not a JavaScript flag you can bypass.
CSRF (cross-site request forgery) is tricking a logged-in browser into sending a cookie-authenticated request the user did not mean to make. The other site cannot read the response; it only needs the request to succeed.
The DOM (Document Object Model) is the browser's tree of nodes for an HTML (or XML) document. JavaScript reads and changes the page by talking to that tree, not by editing the HTML file on disk.
Bubbling is the phase where an event travels from the target node up through its ancestors to document and window. A listener on a parent can see a click that happened on a child.
Capturing is the phase where an event travels from window down the ancestor chain to the target, before the target's own listeners and before bubbling. You opt in with { capture: true }.
Event delegation is one listener on a parent that handles events from many children, using bubbling and event.target (usually with closest). New children are covered automatically.
An event is a notification from the browser or from your own EventTarget: a click, a key, a load, a message. You handle it by registering a listener that receives an Event object.
The History API lets a page change the URL and session history without a full reload. SPAs use pushState / replaceState and the popstate event to keep the address bar in sync with the view.
HTTP is the request/response protocol the web uses. A client sends a method, URL, headers, and optional body; the server answers with a status, headers, and a body.
REST is a style for HTTP APIs: you treat URLs as resources and HTTP methods as verbs. GET /users/7 reads a user; POST /users creates one. Real APIs follow this loosely.
A service worker is a script the browser runs in the background, off the page. It can intercept fetch, cache responses, and show notifications. It is not a Web Worker you send CPU jobs to.
sessionStorage is a string key/value store scoped to an origin and a tab (a browsing session). Closing the tab clears it. A new tab does not see the old tab's data.
A WebSocket is a long-lived, bidirectional channel that starts as an HTTP upgrade and then exchanges messages. Either side can send at any time.
XMLHttpRequest is the older browser API for HTTP. It is event-based (onload, onerror, onprogress) rather than promise-based. fetch replaced it for most code.
map transforms each element, filter keeps elements that pass a test, and reduce folds the list into a single value. They are the standard functional trio on Array.prototype.
Array iteration is walking every element to read or transform it. JavaScript offers for, for...of, and methods such as forEach, map, filter, reduce, some, and every.
Backtracking builds a solution one choice at a time and undoes a choice when it cannot lead to a valid answer. It is depth-first search on an implicit tree of partial solutions.
Breadth-first search visits a graph level by level using a queue. The first time you reach a node in an unweighted graph is a shortest path in number of edges.
Binary search finds a target in a sorted array by repeatedly discarding half of the remaining range. It is O(log n) time and O(1) extra space.
Debounce waits until events stop arriving, then runs once. Throttle runs at most once per interval while events keep arriving. Both turn a noisy event stream into a cheaper one.
Depth-first search walks a graph by going as deep as possible along one path before backtracking. You implement it with recursion or an explicit stack.
Dynamic programming solves a problem by combining answers to overlapping subproblems, storing each answer so you never compute it twice.
A greedy algorithm makes the choice that looks best right now and never retracts it. It is correct only when that local choice is safe for the global answer.
Hashing for lookup means putting values in a Map or Set so later membership and retrieval are average O(1) instead of an O(n) scan.
A prefix-sum array stores the running total up to each index so any range sum arr[i] + ... + arr[j] becomes two lookups and a subtraction, O(1) after O(n) setup.
Recursion is a function calling itself (or a sibling) to solve a smaller piece of the same problem. Every recursive function needs a base case that does not call itself.
A sliding window maintains a contiguous slice of an array or string while two indexes move forward. Each element enters and leaves the window at most once, so the pass is O(n).
Sorting puts a list into an order you define. In JavaScript, array.sort is an in-place, stable comparison sort that defaults to string order, not numeric order.
Space complexity is how extra memory an algorithm needs as the input grows. It counts the structures you allocate, not the input the caller already owns.
Time complexity describes how the work an algorithm does grows as its input grows. It is a shape, not a console.time reading on one machine.
Two pointers is a technique that walks a sequence with two indexes that move toward a goal, often turning an O(n^2) pair scan into O(n) after a sort.
super is syntax for talking to the parent class. super(...) runs the parent constructor. super.method(...) calls the parent's version of a method.
A JavaScript class is syntax for a constructor function plus methods on its prototype. Instances share those methods; each instance has its own fields.
A constructor function is a function you call with new to build an object. The new operator creates a fresh object, links it to the function's .prototype, runs the function with this bound to it, and returns it.
Encapsulation is keeping an object's internals hidden and exposing a small API. In JavaScript that means closures, module scope, or #private fields — not a compiler-enforced private keyword on ordinary properties.
A getter is a function that runs when a property is read, and a setter is a function that runs when it is assigned. Together they let a property look like plain data while executing code behind the scenes.
Inheritance lets one class reuse another class's methods and fields. In JavaScript, extends wires the prototype chain of both the instances and the constructors.
A mixin is reusable behaviour you copy or apply onto a class, because JavaScript classes can extend only one parent. The class has the behaviour; it does not become a second type.
An object is a collection of named properties. It is the container JavaScript uses for almost everything that is not a plain number, string, or boolean, and it is always handled by reference.
Private fields are class members named with a #. Only code in the class body that declared them can read or write them. They are not the same as underscore properties or closures.
A property descriptor is the set of hidden settings attached to every object property: its value, whether it can be changed, whether it shows up in loops, and whether it can be redefined or deleted.
The prototype chain is the sequence of objects the engine walks when looking up a property: the object itself, then its prototype, then that object's prototype, until it reaches null.
A prototype is another object that your object falls back to when a property is not found on it. JavaScript reuses behaviour by delegating to prototypes rather than by copying members into each instance.
A static method lives on the constructor, not on instances. You call User.fromEmail(email), not user.fromEmail(). Static fields work the same way.
A JavaScript array is an ordered, resizable list accessed by numeric index. Under the hood it is an object whose keys are integer-like strings, so it can grow, shrink, and even contain gaps.
An adjacency list stores a graph as a map from each node to the nodes it points at. In JavaScript that is usually a Map of arrays, or a plain object when ids are strings.
A binary heap is a complete binary tree stored in an array so the smallest (or largest) value is always at index 0. Push and pop are O(log n); peek is O(1).
A linked list is a chain of nodes, each holding a value and a reference to the next node (and sometimes the previous). Insert and delete at a known node are O(1); indexing is O(n).
A Map is a collection of key-value pairs that remembers insertion order. Keys can be any value, including objects, and lookup is SameValueZero rather than string coercion.
Using a plain object as a dictionary means treating property names as keys. It works for fixed string keys and fails when keys are user input, numbers you care about, or names that collide with inherited properties.
A Set is a collection of unique values. Adding a value that is already present does nothing, and membership tests are SameValueZero.
A stack is last-in, first-out. A queue is first-in, first-out. In JavaScript both are usually arrays: push/pop for a stack, and push/shift or a linked list / deque for a queue.
A JavaScript string is an immutable sequence of UTF-16 code units. Every method that looks like it edits a string actually returns a new one, and length counts code units rather than characters.
A typed array is a fixed-length view over a block of raw bytes, where every element is the same numeric width. It is how JavaScript reads and writes binary data such as image pixels, network frames, and audio samples.
A WeakMap is a map whose keys must be objects and are held weakly. If nothing else points at a key, the entry can be collected, and you cannot iterate the map.
A WeakSet is a set of objects held weakly. Membership does not keep the object alive, and you cannot iterate the set.
An assertion is a check that fails the test when a value is not what you claimed. In Jest and Vitest you write expect(value).matcher(expected).
Coverage measures which lines, branches, and functions ran during tests. It is a map of execution, not a map of correctness.
Jest is a JavaScript test runner from the Jest project: it discovers files, runs test/expect blocks, and ships mocks, snapshots, and coverage. It is still widely used, especially in React apps.
A mock is a stand-in for a dependency you do not want to run for real. It records calls and can return canned values so the test stays fast and deterministic.
A stub replaces a function's result. A spy records how a function was called, optionally wrapping the real one. Mocks in Jest and Vitest are spies you can stub.
Testing async code means the test waits for promises, timers, or events before asserting. If it does not wait, the runner can pass before the work runs.
Testing Library is a family of packages (@testing-library/dom, /react, /vue) that query the DOM the way a user does: by role, label, and text, not by component internals.
Vitest is a Vite-native test runner with a Jest-compatible API. It uses the same transform pipeline as your Vite app, which makes ESM, TypeScript, and path aliases work with less config.
A closure keeps its lexical environment alive. If that environment holds a large object or a DOM node, and the function is still reachable (a listener, a timer, a cache), those values cannot be collected.
A detached DOM node is an element no longer in the document that is still reachable from JavaScript. The browser cannot free that subtree until your last reference is gone.
Garbage collection reclaims heap objects that your program can no longer reach. You do not free memory by hand; you drop references and the collector notices.
Mark-and-sweep is a garbage-collection algorithm: mark every object reachable from roots, then sweep (reclaim) the objects that were not marked. JavaScript engines use this idea, usually with generations and extra tricks.
The stack holds function frames (return addresses and locals). The heap holds objects, arrays, closures' environments, and anything that outlives a single frame. JavaScript values live in one or the other according to the engine, not according to a keyword you type.
A WeakRef is a pointer that does not keep its target alive. ref.deref() returns the object if it has not been collected, or undefined if it has.
A connection pool keeps a set of open database connections and loans them out. Creating a TCP + auth handshake per query is too slow and will exhaust the server.
IndexedDB is the browser's transactional, origin-scoped database for structured data. It stores more than localStorage and can index fields for queries.
An ORM (object-relational mapper) lets you work with database rows as objects and methods instead of writing every SQL string. In Node the common names are Prisma, Sequelize, TypeORM, Drizzle, and Knex (closer to a query builder).
A query builder is an API that assembles SQL from methods (where, join, limit) and binds parameters for you. It sits between raw SQL strings and a full ORM.
SQL injection is putting untrusted text into a query so it is executed as SQL. Parameter binding keeps data out of the SQL parser. String concatenation does not.
SQL databases store rows in tables with a fixed schema and a query language. NoSQL is a loose label for document, key-value, column, and graph stores that trade some relational features for flexibility or scale.
A transaction is a group of database reads and writes that commit together or roll back together. Either the whole transfer happens, or neither row changes.
A decorator wraps an object or function and adds behaviour while keeping the same calling shape. The caller still calls save(user); logging, retry, or access control happen in the wrapper.
A facade is a thin, friendly API in front of a messy subsystem. Callers use one function or object; the facade talks to fetch, storage, and validation for them.
A factory is a function that creates objects for you. The caller asks for a product; the factory chooses the constructor, the defaults, and the wiring.
Middleware is a chain of functions that each receive a request context and a next callback (or a wrapped handler). Express, Koa, and Redux use this pipeline to add logging, auth, and parsing without editing the core handler.
The module pattern hides private state in a closure and returns a public API object. It is how JavaScript encapsulated code before ES modules existed.
The observer pattern lets objects subscribe to notifications. When the subject changes, it calls every observer. DOM events, EventTarget, and Rx-style streams are this idea.
A proxy stands in for another object and controls access to it. JavaScript's Proxy type intercepts property reads, writes, and calls so you can log, validate, or virtualise the target.
Publish/subscribe is messaging through a channel name. Publishers emit on a topic; subscribers listen on that topic. They do not hold references to each other.
The revealing module pattern defines functions as locals, then returns an object that reveals some of them under public names. Private helpers stay unexported.
A singleton is a type that has one instance. In JavaScript that is usually a module-level object, not a class with a private constructor.
Strategy is swapping an algorithm behind a shared interface. In JavaScript that interface is usually a function you pass in, not a class hierarchy.