JavaScript State & Architecture Glossary
Programming
Writing instructions that a computer can execute.
Writing instructions that a computer can execute. The example shows its use in JavaScript source.
console.log("Hello");Program
A collection of instructions intended to accomplish a task.
A collection of instructions intended to accomplish a task. The example shows its use in JavaScript source.
console.log(2 + 3);
Source code
The human-readable text of a program.
The human-readable text of a program. The example shows its use in JavaScript source.
let score = 1;
Instruction
An operation described by source code.
An operation described by source code. The example shows its use in JavaScript source.
console.log("Run");Statement
A complete syntactic unit such as a declaration or expression statement.
A complete syntactic unit such as a declaration or expression statement. The example shows its use in JavaScript source.
let total = 5;
Expression
Source that evaluates to a value.
Source that evaluates to a value. The example shows its use in JavaScript source.
5 * 3
Value
A piece of data that a program can use.
A piece of data that a program can use. The example shows its use in JavaScript source.
42
Syntax
The grammatical rules for valid source code.
The grammatical rules for valid source code. The example shows its use in JavaScript source.
console.log("Hello");Comment
Source text ignored during execution and intended for readers.
Source text ignored during execution and intended for readers. The example shows its use in JavaScript source.
// Explain the rule.
Identifier
A name used to refer to a binding or other program entity.
A name used to refer to a binding or other program entity. The example shows its use in JavaScript source.
itemsInCart
Keyword
A word reserved for a language construct.
A word reserved for a language construct. The example shows its use in JavaScript source.
const
Semicolon
A statement separator or terminator in source syntax.
A statement separator or terminator in source syntax. The example shows its use in JavaScript source.
let x = 1;
Parentheses
Symbols used for grouping or call argument lists.
Symbols used for grouping or call argument lists. The example shows its use in JavaScript source.
(5 + 2) * 3
Brace
A symbol used to delimit blocks or object literals.
A symbol used to delimit blocks or object literals. The example shows its use in JavaScript source.
if (true) { console.log("yes"); }Bracket
A symbol used in array literals or property access.
A symbol used in array literals or property access. The example shows its use in JavaScript source.
items[0]
Literal
Source syntax directly representing a value.
Source syntax directly representing a value. The example shows its use in JavaScript source.
"Hello"
Console
A diagnostic interface where programs record messages.
A diagnostic interface where programs record messages. The example shows its use in JavaScript source.
console.log("Ready");Output
An observable result produced by execution.
An observable result produced by execution. The example shows its use in JavaScript source.
console.log(15);
Input
Data supplied to a program or function.
Data supplied to a program or function. The example shows its use in JavaScript source.
greet("Alex")Algorithm
A defined sequence of steps for solving a problem.
A defined sequence of steps for solving a problem. The example shows its use in JavaScript source.
Read numbers, add them, display the sum.
Variable
A named binding used to access a value.
A named binding used to access a value. The example shows its use in JavaScript source.
let score = 3;
Binding
The association between a name and a value.
The association between a name and a value. The example shows its use in JavaScript source.
const title = "Course";
Declaration
Syntax that introduces a binding.
Syntax that introduces a binding. The example shows its use in JavaScript source.
let count;
Assignment
An operation that stores a value in an existing binding.
An operation that stores a value in an existing binding. The example shows its use in JavaScript source.
count = 2;
Reassignment
Replacing the value associated with a binding.
Replacing the value associated with a binding. The example shows its use in JavaScript source.
count = 3;
let
A block-scoped declaration that allows reassignment.
A block-scoped declaration that allows reassignment. The example shows its use in JavaScript source.
let count = 0;
const
A block-scoped declaration that prevents reassignment of its binding.
A block-scoped declaration that prevents reassignment of its binding. The example shows its use in JavaScript source.
const rate = 0.1;
var
An older function-scoped declaration with hoisting behavior.
An older function-scoped declaration with hoisting behavior. The example shows its use in JavaScript source.
var legacy = 1;
Data type
A category describing what a value is and which operations apply.
A category describing what a value is and which operations apply. The example shows its use in JavaScript source.
typeof 5
String
A primitive sequence of UTF-16 code units representing text.
A primitive sequence of UTF-16 code units representing text. The example shows its use in JavaScript source.
"JavaScript"
Number
The standard numeric type using floating-point representation.
The standard numeric type using floating-point representation. The example shows its use in JavaScript source.
3.5
Boolean
A primitive logical value, either true or false.
A primitive logical value, either true or false. The example shows its use in JavaScript source.
true
null
An explicit primitive value often representing intentional absence.
An explicit primitive value often representing intentional absence. The example shows its use in JavaScript source.
const selected = null;
undefined
A primitive often observed when a value was not supplied or returned.
A primitive often observed when a value was not supplied or returned. The example shows its use in JavaScript source.
let pending;
NaN
A numeric value representing an invalid numeric result.
A numeric value representing an invalid numeric result. The example shows its use in JavaScript source.
Number("not a number")Infinity
A numeric value beyond finite magnitude.
A numeric value beyond finite magnitude. The example shows its use in JavaScript source.
1 / 0
BigInt
An integer numeric type for arbitrarily large whole values.
An integer numeric type for arbitrarily large whole values. The example shows its use in JavaScript source.
123n
Symbol
A primitive value with unique identity, often used as a property key.
A primitive value with unique identity, often used as a property key. The example shows its use in JavaScript source.
Symbol("id")Primitive
A non-object value such as a string, number or Boolean.
A non-object value such as a string, number or Boolean. The example shows its use in JavaScript source.
typeof "text"
Type conversion
Creating a representation of a value in another type.
Creating a representation of a value in another type. The example shows its use in JavaScript source.
Number("12")Coercion
Conversion performed implicitly by a language operation.
Conversion performed implicitly by a language operation. The example shows its use in JavaScript source.
"5" + 2
Truthy
A value that becomes true in Boolean context.
A value that becomes true in Boolean context. The example shows its use in JavaScript source.
Boolean("hello")Falsy
A value that becomes false in Boolean context.
A value that becomes false in Boolean context. The example shows its use in JavaScript source.
Boolean("")Immutability
The property of a value that cannot be changed in place.
The property of a value that cannot be changed in place. The example shows its use in JavaScript source.
"text".toUpperCase()
Mutation
Changing the contents of an existing object or array.
Changing the contents of an existing object or array. The example shows its use in JavaScript source.
items.push("new");State
The current values relevant to an application.
The current values relevant to an application. The example shows its use in JavaScript source.
let count = 0;
Reference
An identity-bearing relationship to an object value.
An identity-bearing relationship to an object value. The example shows its use in JavaScript source.
const other = original;
Shallow copy
A new outer object that still shares nested referenced values.
A new outer object that still shares nested referenced values. The example shows its use in JavaScript source.
const copy = {...original};Deep copy
A copy that recreates supported nested data rather than sharing it.
A copy that recreates supported nested data rather than sharing it. The example shows its use in JavaScript source.
structuredClone(record)
Serialization
Converting a supported value into a transport representation.
Converting a supported value into a transport representation. The example shows its use in JavaScript source.
JSON.stringify(record)
Condition
An expression used to select a control-flow branch.
An expression used to select a control-flow branch. The example shows its use in JavaScript source.
score >= 5
Branch
One possible path chosen by control flow.
One possible path chosen by control flow. The example shows its use in JavaScript source.
if (ready) { run(); }Loop
A construct that repeats operations while its rule allows it.
A construct that repeats operations while its rule allows it. The example shows its use in JavaScript source.
for (let i = 0; i < 3; i++) {}Iteration
One pass through a loop body.
One pass through a loop body. The example shows its use in JavaScript source.
console.log(i);
Accumulator
A value carrying a running result across iterations.
A value carrying a running result across iterations. The example shows its use in JavaScript source.
sum += value;
Counter
A binding that tracks a changing count or position.
A binding that tracks a changing count or position. The example shows its use in JavaScript source.
i++
Infinite loop
Repetition whose stopping condition is never reached.
Repetition whose stopping condition is never reached. The example shows its use in JavaScript source.
while (true) {}Function
A callable unit of reusable behavior.
A callable unit of reusable behavior. The example shows its use in JavaScript source.
function double(n) { return n * 2; }Parameter
A binding declared to receive a function argument.
A binding declared to receive a function argument. The example shows its use in JavaScript source.
function greet(name) {}Argument
A value supplied in a call.
A value supplied in a call. The example shows its use in JavaScript source.
greet("Alex")Return value
The result given by a function to its caller.
The result given by a function to its caller. The example shows its use in JavaScript source.
return total;
Callback
A function supplied to another operation for later or repeated invocation.
A function supplied to another operation for later or repeated invocation. The example shows its use in JavaScript source.
items.map(double)
Arrow function
A function expression using arrow syntax and lexical this.
A function expression using arrow syntax and lexical this. The example shows its use in JavaScript source.
n => n * 2
Scope
The region in which a binding can be accessed.
The region in which a binding can be accessed. The example shows its use in JavaScript source.
{ let local = 1; }Block scope
Visibility limited to the enclosing block.
Visibility limited to the enclosing block. The example shows its use in JavaScript source.
if (true) { let x = 1; }Global scope
The outer scope for a script environment.
The outer scope for a script environment. The example shows its use in JavaScript source.
globalThis
Local scope
A scope belonging to an inner function or block.
A scope belonging to an inner function or block. The example shows its use in JavaScript source.
function f() { const local = 1; }Closure
A function retaining access to bindings from its creation environment.
A function retaining access to bindings from its creation environment. The example shows its use in JavaScript source.
function make(n) { return () => n; }Call stack
The active sequence of function calls waiting to finish.
The active sequence of function calls waiting to finish. The example shows its use in JavaScript source.
outer() calls inner()
Stack frame
The execution context of a particular active function call.
The execution context of a particular active function call. The example shows its use in JavaScript source.
double(4)
Recursion
A function invoking itself with a defined stopping case.
A function invoking itself with a defined stopping case. The example shows its use in JavaScript source.
factorial(n - 1)
Base case
A condition that stops a recursive calculation.
A condition that stops a recursive calculation. The example shows its use in JavaScript source.
if (n === 0) return 1;
Pure function
A function whose result depends on arguments and does not mutate external state.
A function whose result depends on arguments and does not mutate external state. The example shows its use in JavaScript source.
n => n * 2
Side effect
An observable change outside a function’s returned value.
An observable change outside a function’s returned value. The example shows its use in JavaScript source.
element.textContent = "Updated";
Hoisting
The observable early establishment of certain declarations in a scope.
The observable early establishment of certain declarations in a scope. The example shows its use in JavaScript source.
function declarations can be called before their source position
Temporal dead zone
The region before a lexical binding is initialized where access throws.
The region before a lexical binding is initialized where access throws. The example shows its use in JavaScript source.
console.log(x); let x = 1;
Destructuring
Syntax extracting values from arrays or object properties.
Syntax extracting values from arrays or object properties. The example shows its use in JavaScript source.
const {name} = person;Spread syntax
Syntax expanding iterable elements or copying object properties.
Syntax expanding iterable elements or copying object properties. The example shows its use in JavaScript source.
[...items]
Rest parameter
A parameter collecting remaining arguments into an array.
A parameter collecting remaining arguments into an array. The example shows its use in JavaScript source.
function sum(...values) {}Default parameter
An initializer used when an argument is undefined.
An initializer used when an argument is undefined. The example shows its use in JavaScript source.
function greet(name = "friend") {}Array
An ordered, indexed object commonly used as a collection.
An ordered, indexed object commonly used as a collection. The example shows its use in JavaScript source.
["Learn", "Build"]
Index
A numeric position used to access an array element.
A numeric position used to access an array element. The example shows its use in JavaScript source.
items[0]
Element
A value stored at an array position.
A value stored at an array position. The example shows its use in JavaScript source.
items[1]
Length
The array boundary or string code-unit count reported by length.
The array boundary or string code-unit count reported by length. The example shows its use in JavaScript source.
items.length
Object
A value that groups named properties and has identity.
A value that groups named properties and has identity. The example shows its use in JavaScript source.
{name: "Alex"}Property
A key-value association on an object.
A key-value association on an object. The example shows its use in JavaScript source.
person.name
Key
A string or symbol identifying an object property.
A string or symbol identifying an object property. The example shows its use in JavaScript source.
"name"
Method
A callable property associated with an object.
A callable property associated with an object. The example shows its use in JavaScript source.
text.trim()
Prototype
An object consulted during inherited property lookup.
An object consulted during inherited property lookup. The example shows its use in JavaScript source.
Object.getPrototypeOf(record)
Class
Syntax for defining construction and prototype-based behavior.
Syntax for defining construction and prototype-based behavior. The example shows its use in JavaScript source.
class Counter {}Instance
An object created with a particular constructor.
An object created with a particular constructor. The example shows its use in JavaScript source.
new Counter()
Constructor
A function used to initialize an object through new.
A function used to initialize an object through new. The example shows its use in JavaScript source.
constructor(name) { this.name = name; }this
A binding whose value depends on the call form, except lexical arrows.
A binding whose value depends on the call form, except lexical arrows. The example shows its use in JavaScript source.
this.name
Getter
An accessor invoked when a property is read.
An accessor invoked when a property is read. The example shows its use in JavaScript source.
get total() { return this.price * this.qty; }Setter
An accessor invoked when a property is assigned.
An accessor invoked when a property is assigned. The example shows its use in JavaScript source.
set value(n) { this._value = n; }Static method
A method available on the class constructor rather than instances.
A method available on the class constructor rather than instances. The example shows its use in JavaScript source.
Math.abs(-2)
Map collection
A keyed collection supporting arbitrary value keys.
A keyed collection supporting arbitrary value keys. The example shows its use in JavaScript source.
new Map()
Set collection
A collection of unique values.
A collection of unique values. The example shows its use in JavaScript source.
new Set([1,1,2])
Iterable
A value providing an iterator used by constructs such as for...of.
A value providing an iterator used by constructs such as for...of. The example shows its use in JavaScript source.
for (const item of items) {}Iterator
An object producing successive values with next().
An object producing successive values with next(). The example shows its use in JavaScript source.
items.values()
HTML
The markup language describing webpage structure and content.
The markup language describing webpage structure and content. The example shows its use in JavaScript source.
<button>Run</button>
CSS
The styling language describing webpage presentation.
The styling language describing webpage presentation. The example shows its use in JavaScript source.
button { color: green; }DOM
The document tree exposed as objects to browser JavaScript.
The document tree exposed as objects to browser JavaScript. The example shows its use in JavaScript source.
document.body
Node
An object participating in a document tree.
An object participating in a document tree. The example shows its use in JavaScript source.
element.firstChild
Element node
A node representing an HTML or SVG element.
A node representing an HTML or SVG element. The example shows its use in JavaScript source.
document.createElement("p")Text node
A node containing literal document text.
A node containing literal document text. The example shows its use in JavaScript source.
document.createTextNode("Hello")Attribute
A named markup setting associated with an element.
A named markup setting associated with an element. The example shows its use in JavaScript source.
id="result"
Selector
A pattern used to locate matching elements.
A pattern used to locate matching elements. The example shows its use in JavaScript source.
#result
Event
An occurrence dispatched to an event target.
An occurrence dispatched to an event target. The example shows its use in JavaScript source.
click
Event listener
A registered callback invoked for a specified event.
A registered callback invoked for a specified event. The example shows its use in JavaScript source.
button.addEventListener("click", handler)Event target
The node where an event originated.
The node where an event originated. The example shows its use in JavaScript source.
event.target
Current target
The object whose listener is currently running.
The object whose listener is currently running. The example shows its use in JavaScript source.
event.currentTarget
Bubbling
Propagation of an event through ancestor targets after its target phase.
Propagation of an event through ancestor targets after its target phase. The example shows its use in JavaScript source.
A button click reaches its parent listener.
Capture phase
The propagation phase traveling toward the target before bubbling.
The propagation phase traveling toward the target before bubbling. The example shows its use in JavaScript source.
addEventListener("click", handler, true)Delegation
Handling child actions using an ancestor listener.
Handling child actions using an ancestor listener. The example shows its use in JavaScript source.
list.addEventListener("click", handler)Default action
A browser behavior associated with an event, such as form navigation.
A browser behavior associated with an event, such as form navigation. The example shows its use in JavaScript source.
event.preventDefault()
Form validation
Checking whether submitted field values satisfy constraints.
Checking whether submitted field values satisfy constraints. The example shows its use in JavaScript source.
input.checkValidity()
Accessibility
Designing functionality usable by people with varied access needs.
Designing functionality usable by people with varied access needs. The example shows its use in JavaScript source.
Use a labeled native button.
Accessible name
The label exposed for an interactive element to accessibility APIs.
The label exposed for an interactive element to accessibility APIs. The example shows its use in JavaScript source.
aria-label="Increase count"
Focus
The current keyboard interaction target.
The current keyboard interaction target. The example shows its use in JavaScript source.
input.focus()
Live region
An area whose updates can be announced by assistive technology.
An area whose updates can be announced by assistive technology. The example shows its use in JavaScript source.
role="status"
Rendering
Producing visible interface content from current state.
Producing visible interface content from current state. The example shows its use in JavaScript source.
render(records)
Component
A bounded reusable unit of interface structure and behavior.
A bounded reusable unit of interface structure and behavior. The example shows its use in JavaScript source.
createCounter(container)
Persistence
Retaining data across a page or application session.
Retaining data across a page or application session. The example shows its use in JavaScript source.
localStorage.setItem(key, text)
Origin
The scheme, host and port used to isolate browser resources.
The scheme, host and port used to isolate browser resources. The example shows its use in JavaScript source.
https://example.test:443
Sandbox
A restricted environment limiting the capabilities of executed content.
A restricted environment limiting the capabilities of executed content. The example shows its use in JavaScript source.
<iframe sandbox="allow-scripts">
Web Worker
A separate execution context suited to non-DOM JavaScript work.
A separate execution context suited to non-DOM JavaScript work. The example shows its use in JavaScript source.
new Worker(url)
IndexedDB
An asynchronous browser database for structured local data.
An asynchronous browser database for structured local data. The example shows its use in JavaScript source.
indexedDB.open("academy", 1)localStorage
A per-origin string-keyed browser storage interface.
A per-origin string-keyed browser storage interface. The example shows its use in JavaScript source.
localStorage.getItem("draft")Responsive layout
An interface adapting to different available display sizes.
An interface adapting to different available display sizes. The example shows its use in JavaScript source.
@media (max-width: 600px) {}Synchronous
Execution that proceeds in the current call sequence before returning control.
Execution that proceeds in the current call sequence before returning control. The example shows its use in JavaScript source.
console.log("A"); console.log("B");Asynchronous
Behavior whose result is delivered after the current sequence yields.
Behavior whose result is delivered after the current sequence yields. The example shows its use in JavaScript source.
setTimeout(handler, 0)
Promise
An object representing eventual fulfillment or rejection.
An object representing eventual fulfillment or rejection. The example shows its use in JavaScript source.
Promise.resolve(5)
Fulfillment
Successful settlement of a promise with a value.
Successful settlement of a promise with a value. The example shows its use in JavaScript source.
resolve(value)
Rejection
Settlement of a promise with a failure reason.
Settlement of a promise with a failure reason. The example shows its use in JavaScript source.
reject(error)
Pending
The unsettled state of a promise.
The unsettled state of a promise. The example shows its use in JavaScript source.
new Promise(() => {})async function
A function whose call returns a promise.
A function whose call returns a promise. The example shows its use in JavaScript source.
async function load() { return 1; }await
Syntax that suspends an async evaluation until a value’s promise settles.
Syntax that suspends an async evaluation until a value’s promise settles. The example shows its use in JavaScript source.
const result = await load();
Task
A unit scheduled to run after the current task yields.
A unit scheduled to run after the current task yields. The example shows its use in JavaScript source.
A timer callback is a task.
Microtask
A scheduled job drained at microtask checkpoints.
A scheduled job drained at microtask checkpoints. The example shows its use in JavaScript source.
Promise.resolve().then(handler)
Event loop
The scheduling process coordinating tasks, microtasks and rendering opportunities.
The scheduling process coordinating tasks, microtasks and rendering opportunities. The example shows its use in JavaScript source.
A, D, C, B in the prepared example
Timer
An API scheduling a callback no earlier than a requested delay.
An API scheduling a callback no earlier than a requested delay. The example shows its use in JavaScript source.
setTimeout(handler, 100)
API
A defined interface through which software requests data or behavior.
A defined interface through which software requests data or behavior. The example shows its use in JavaScript source.
fetch(url)
HTTP
The request/response protocol used for web resources.
The request/response protocol used for web resources. The example shows its use in JavaScript source.
GET /courses
Request
A message asking a service for a resource or action.
A message asking a service for a resource or action. The example shows its use in JavaScript source.
fetch("/data")Response
The result message returned by a request operation.
The result message returned by a request operation. The example shows its use in JavaScript source.
response.status
Status code
A numeric indication of an HTTP outcome.
A numeric indication of an HTTP outcome. The example shows its use in JavaScript source.
404
Header
Metadata associated with a request or response.
Metadata associated with a request or response. The example shows its use in JavaScript source.
Content-Type: application/json
JSON
A text format for structured values with restricted syntax.
A text format for structured values with restricted syntax. The example shows its use in JavaScript source.
{"title":"Course"}CORS
Browser-enforced cross-origin access rules for response visibility.
Browser-enforced cross-origin access rules for response visibility. The example shows its use in JavaScript source.
Access-Control-Allow-Origin
Exception
A thrown value interrupting ordinary control flow.
A thrown value interrupting ordinary control flow. The example shows its use in JavaScript source.
throw new Error("Invalid");Runtime error
A failure occurring while code executes.
A failure occurring while code executes. The example shows its use in JavaScript source.
missingName()
Syntax error
A parse failure caused by invalid source grammar.
A parse failure caused by invalid source grammar. The example shows its use in JavaScript source.
console.log("unclosed);Logic error
Behavior that runs but violates intended requirements.
Behavior that runs but violates intended requirements. The example shows its use in JavaScript source.
Using + where multiplication was required
Debugging
Investigating observed behavior to locate and repair a defect.
Investigating observed behavior to locate and repair a defect. The example shows its use in JavaScript source.
Compare expected and actual values.
Breakpoint
A debugger stopping point used to inspect an active execution.
A debugger stopping point used to inspect an active execution. The example shows its use in JavaScript source.
Pause at a chosen source line.
Test
A repeatable check of behavior against an independent expectation.
A repeatable check of behavior against an independent expectation. The example shows its use in JavaScript source.
assert.equal(double(2), 4)
Assertion
An explicit condition required by a test.
An explicit condition required by a test. The example shows its use in JavaScript source.
actual === expected
Boundary case
An input at an edge of the defined behavior.
An input at an edge of the defined behavior. The example shows its use in JavaScript source.
An empty array
Regression
A previously working behavior broken by a later change.
A previously working behavior broken by a later change. The example shows its use in JavaScript source.
A filter now loses saved selections.
Module
A file-level unit with explicit imports and exports.
A file-level unit with explicit imports and exports. The example shows its use in JavaScript source.
export function double(n) { return n*2; }Dependency
A module or capability another unit requires.
A module or capability another unit requires. The example shows its use in JavaScript source.
import {double} from "./math.js";Refactoring
Changing structure while preserving intended behavior.
Changing structure while preserving intended behavior. The example shows its use in JavaScript source.
Extract a tested calculation helper.
Requirement
An observable behavior or constraint the application must satisfy.
An observable behavior or constraint the application must satisfy. The example shows its use in JavaScript source.
Blank task names are rejected.
Deployment
Making tested application files available in their target environment.
Making tested application files available in their target environment. The example shows its use in JavaScript source.
Upload HTML, CSS and JavaScript together.
Array.map
Creates an array from callback results for each existing source element.
Creates an array from callback results for each existing source element. The example shows its use in JavaScript source.
[1,2].map(n => n*2)
Array.filter
Creates an array of elements whose predicate is truthy.
Creates an array of elements whose predicate is truthy. The example shows its use in JavaScript source.
[1,2].filter(n => n>1)
Array.find
Returns the first matching element or undefined.
Returns the first matching element or undefined. The example shows its use in JavaScript source.
items.find(x => x.id === 1)
Array.findIndex
Returns the first matching position or -1.
Returns the first matching position or -1. The example shows its use in JavaScript source.
items.findIndex(x => x.done)
Array.some
Reports whether any element satisfies a predicate.
Reports whether any element satisfies a predicate. The example shows its use in JavaScript source.
items.some(x => x.done)
Array.every
Reports whether all existing elements satisfy a predicate.
Reports whether all existing elements satisfy a predicate. The example shows its use in JavaScript source.
items.every(x => x.done)
Array.reduce
Accumulates elements into a single result using a callback.
Accumulates elements into a single result using a callback. The example shows its use in JavaScript source.
[1,2].reduce((sum,n)=>sum+n,0)
Array.sort
Sorts an array in place using an optional comparison function.
Sorts an array in place using an optional comparison function. The example shows its use in JavaScript source.
[10,2].sort((a,b)=>a-b)
Array.slice
Returns a shallow section with an exclusive end boundary.
Returns a shallow section with an exclusive end boundary. The example shows its use in JavaScript source.
items.slice(1,3)
Array.splice
Removes or inserts elements in place and returns removed elements.
Removes or inserts elements in place and returns removed elements. The example shows its use in JavaScript source.
items.splice(1,1)
Array.push
Appends elements in place and returns the new length.
Appends elements in place and returns the new length. The example shows its use in JavaScript source.
items.push("new")Array.pop
Removes and returns the last element.
Removes and returns the last element. The example shows its use in JavaScript source.
items.pop()
Array.shift
Removes and returns the first element.
Removes and returns the first element. The example shows its use in JavaScript source.
items.shift()
Array.unshift
Prepends elements and returns the new length.
Prepends elements and returns the new length. The example shows its use in JavaScript source.
items.unshift("first")Array.reverse
Reverses an array in place.
Reverses an array in place. The example shows its use in JavaScript source.
items.reverse()
Array.includes
Tests whether an array contains a value using SameValueZero comparison.
Tests whether an array contains a value using SameValueZero comparison. The example shows its use in JavaScript source.
items.includes("Code")Array.join
Combines element string representations using a separator.
Combines element string representations using a separator. The example shows its use in JavaScript source.
["a","b"].join("-")Array.flat
Creates a new array with selected nested levels flattened.
Creates a new array with selected nested levels flattened. The example shows its use in JavaScript source.
[[1],[2]].flat()
Array.isArray
Reports whether a value is an array.
Reports whether a value is an array. The example shows its use in JavaScript source.
Array.isArray([])
String.trim
Returns text without leading and trailing whitespace.
Returns text without leading and trailing whitespace. The example shows its use in JavaScript source.
" hi ".trim()
String.toUpperCase
Returns the uppercase form of a string.
Returns the uppercase form of a string. The example shows its use in JavaScript source.
"code".toUpperCase()
String.toLowerCase
Returns the lowercase form of a string.
Returns the lowercase form of a string. The example shows its use in JavaScript source.
"CODE".toLowerCase()
String.slice
Returns a string section with an exclusive end boundary.
Returns a string section with an exclusive end boundary. The example shows its use in JavaScript source.
"Code".slice(0,2)
String.includes
Reports whether one string contains a given substring.
Reports whether one string contains a given substring. The example shows its use in JavaScript source.
"JavaScript".includes("Script")String.replace
Returns a string with the first matching string or matching regex replaced.
Returns a string with the first matching string or matching regex replaced. The example shows its use in JavaScript source.
"a b".replace(" ","-")String.replaceAll
Returns a string with all selected matches replaced.
Returns a string with all selected matches replaced. The example shows its use in JavaScript source.
"a a".replaceAll("a","b")String.split
Splits a string into an array using a separator.
Splits a string into an array using a separator. The example shows its use in JavaScript source.
"a,b".split(",")String.startsWith
Reports whether a string begins with the supplied text.
Reports whether a string begins with the supplied text. The example shows its use in JavaScript source.
"Hello".startsWith("He")String.endsWith
Reports whether a string ends with the supplied text.
Reports whether a string ends with the supplied text. The example shows its use in JavaScript source.
"file.js".endsWith(".js")Number.isFinite
Checks that a value is a number and has finite magnitude.
Checks that a value is a number and has finite magnitude. The example shows its use in JavaScript source.
Number.isFinite(3)
Number.isInteger
Checks that a numeric value has no fractional component.
Checks that a numeric value has no fractional component. The example shows its use in JavaScript source.
Number.isInteger(3)
Number.isNaN
Checks specifically for the numeric NaN value.
Checks specifically for the numeric NaN value. The example shows its use in JavaScript source.
Number.isNaN(NaN)
Object.keys
Returns an array of enumerable own string property names.
Returns an array of enumerable own string property names. The example shows its use in JavaScript source.
Object.keys({a:1})Object.values
Returns an array of enumerable own string property values.
Returns an array of enumerable own string property values. The example shows its use in JavaScript source.
Object.values({a:1})Object.entries
Returns enumerable own string key-value pairs.
Returns enumerable own string key-value pairs. The example shows its use in JavaScript source.
Object.entries({a:1})Object.fromEntries
Builds an object from iterable key-value entries.
Builds an object from iterable key-value entries. The example shows its use in JavaScript source.
Object.fromEntries([["a",1]])
Object.hasOwn
Tests whether a property belongs directly to an object.
Tests whether a property belongs directly to an object. The example shows its use in JavaScript source.
Object.hasOwn(record,"name")
JSON.parse
Converts valid JSON text into a JavaScript value.
Converts valid JSON text into a JavaScript value. The example shows its use in JavaScript source.
JSON.parse("[1,2]")JSON.stringify
Serializes supported values as JSON text.
Serializes supported values as JSON text. The example shows its use in JavaScript source.
JSON.stringify({a:1})Math.floor
Rounds a number toward negative infinity.
Rounds a number toward negative infinity. The example shows its use in JavaScript source.
Math.floor(2.8)
Math.round
Rounds a number to a nearest integer under JavaScript’s tie rules.
Rounds a number to a nearest integer under JavaScript’s tie rules. The example shows its use in JavaScript source.
Math.round(2.6)
Math.max
Returns the largest supplied numeric value.
Returns the largest supplied numeric value. The example shows its use in JavaScript source.
Math.max(2,5)
Math.min
Returns the smallest supplied numeric value.
Returns the smallest supplied numeric value. The example shows its use in JavaScript source.
Math.min(2,5)
Math.random
Produces a pseudorandom number from zero inclusive to one exclusive.
Produces a pseudorandom number from zero inclusive to one exclusive. The example shows its use in JavaScript source.
Math.random()
querySelector
Returns the first matching element or null.
Returns the first matching element or null. The example shows its use in JavaScript source.
document.querySelector("#result")querySelectorAll
Returns a static NodeList of matching elements.
Returns a static NodeList of matching elements. The example shows its use in JavaScript source.
document.querySelectorAll("button")textContent
Reads or sets literal text content of a node.
Reads or sets literal text content of a node. The example shows its use in JavaScript source.
element.textContent = "Hello";
classList
Exposes token operations for an element’s class attribute.
Exposes token operations for an element’s class attribute. The example shows its use in JavaScript source.
element.classList.toggle("active")createElement
Creates an element without inserting it into the document.
Creates an element without inserting it into the document. The example shows its use in JavaScript source.
document.createElement("li")append
Adds supplied nodes or strings after existing children.
Adds supplied nodes or strings after existing children. The example shows its use in JavaScript source.
list.append(item)
remove
Detaches a node from its parent.
Detaches a node from its parent. The example shows its use in JavaScript source.
item.remove()
preventDefault
Cancels an event’s cancelable default action.
Cancels an event’s cancelable default action. The example shows its use in JavaScript source.
event.preventDefault()
stopPropagation
Prevents further propagation without canceling the default action.
Prevents further propagation without canceling the default action. The example shows its use in JavaScript source.
event.stopPropagation()
Promise.all
Fulfills with all values or rejects when an input rejects.
Fulfills with all values or rejects when an input rejects. The example shows its use in JavaScript source.
Promise.all([loadA(),loadB()])
Promise.allSettled
Collects the fulfillment or rejection outcome of every input.
Collects the fulfillment or rejection outcome of every input. The example shows its use in JavaScript source.
Promise.allSettled(tasks)
Promise.resolve
Adopts a supplied value or promise into a promise.
Adopts a supplied value or promise into a promise. The example shows its use in JavaScript source.
Promise.resolve(5)
Promise.reject
Creates an already-rejected promise with a reason.
Creates an already-rejected promise with a reason. The example shows its use in JavaScript source.
Promise.reject(new Error("No"))finally
Registers cleanup that runs after a promise settles.
Registers cleanup that runs after a promise settles. The example shows its use in JavaScript source.
request.finally(cleanup)
AbortController
Creates a signal used to request cancellation from supporting APIs.
Creates a signal used to request cancellation from supporting APIs. The example shows its use in JavaScript source.
controller.abort()
requestAnimationFrame
Schedules a callback before a future rendering update.
Schedules a callback before a future rendering update. The example shows its use in JavaScript source.
requestAnimationFrame(render)
MutationObserver
Observes selected changes to the DOM tree.
Observes selected changes to the DOM tree. The example shows its use in JavaScript source.
new MutationObserver(handler)
ResizeObserver
Observes changes to element box sizes.
Observes changes to element box sizes. The example shows its use in JavaScript source.
new ResizeObserver(handler)
URLSearchParams
Reads and writes encoded query parameters.
Reads and writes encoded query parameters. The example shows its use in JavaScript source.
new URLSearchParams("q=code")FormData
Collects named form values into a form-data entry list.
Collects named form values into a form-data entry list. The example shows its use in JavaScript source.
new FormData(form)
CustomEvent
An event carrying an application-defined detail value.
An event carrying an application-defined detail value. The example shows its use in JavaScript source.
new CustomEvent("saved", {detail:record})Operator
Syntax performing an operation on one or more operands.
Syntax performing an operation on one or more operands. The example shows its use in JavaScript source.
5 + 3
Operand
A value or expression to which an operator is applied.
A value or expression to which an operator is applied. The example shows its use in JavaScript source.
5 and 3 in 5 + 3
Binary operator
An operator with two operands.
An operator with two operands. The example shows its use in JavaScript source.
price * quantity
Unary operator
An operator with one operand.
An operator with one operand. The example shows its use in JavaScript source.
!ready
Strict equality
An equality comparison that does not coerce different operand types.
An equality comparison that does not coerce different operand types. The example shows its use in JavaScript source.
5 === "5"
Ternary operator
A conditional expression selecting one of two values.
A conditional expression selecting one of two values. The example shows its use in JavaScript source.
ready ? "Go" : "Wait"
Nullish coalescing
An operator selecting a fallback only for null or undefined.
An operator selecting a fallback only for null or undefined. The example shows its use in JavaScript source.
value ?? "Unknown"
Optional chaining
Access syntax that short-circuits on null or undefined.
Access syntax that short-circuits on null or undefined. The example shows its use in JavaScript source.
person.address?.city
Comparison operator
An operator producing a Boolean comparison result.
An operator producing a Boolean comparison result. The example shows its use in JavaScript source.
score >= 5
Logical operator
An operator combining or negating logical conditions with short-circuit behavior where defined.
An operator combining or negating logical conditions with short-circuit behavior where defined. The example shows its use in JavaScript source.
ready && confirmed
Template literal
A backtick-delimited string form allowing interpolation and line breaks.
A backtick-delimited string form allowing interpolation and line breaks. The example shows its use in JavaScript source.
`Hello, ${name}`UTF-16 code unit
A 16-bit storage unit used by JavaScript string indexing and length.
A 16-bit storage unit used by JavaScript string indexing and length. The example shows its use in JavaScript source.
"Code".length
Code point
A numeric identifier in the Unicode character repertoire.
A numeric identifier in the Unicode character repertoire. The example shows its use in JavaScript source.
"A".codePointAt(0)
Grapheme cluster
A sequence of code points commonly perceived as one written character.
A sequence of code points commonly perceived as one written character. The example shows its use in JavaScript source.
A letter combined with an accent
Event handler
A callback responding to a dispatched event.
A callback responding to a dispatched event. The example shows its use in JavaScript source.
button.addEventListener("click", handler)Debouncing
Delaying work until a specified quiet period follows repeated events.
Delaying work until a specified quiet period follows repeated events. The example shows its use in JavaScript source.
Schedule search after typing pauses.
Throttling
Limiting how often work may run during repeated events.
Limiting how often work may run during repeated events. The example shows its use in JavaScript source.
Limit a scroll computation to a planned interval.
Content Security Policy
A browser-enforced policy restricting resource loading and code execution capabilities.
A browser-enforced policy restricting resource loading and code execution capabilities. The example shows its use in JavaScript source.
connect-src 'none'
Source map
Metadata connecting transformed code locations to original source locations.
Metadata connecting transformed code locations to original source locations. The example shows its use in JavaScript source.
A debugger maps a bundle line to app.js.
Rate limit
A service rule bounding request or resource use over an interval.
A service rule bounding request or resource use over an interval. The example shows its use in JavaScript source.
Handle an HTTP 429 response without an infinite retry loop.