Searchable glossary: 200 browser diagnostics and programming terms
Browser responsibilities
A browser retrieves documents, constructs a document model, resolves style and schedules work before pixels can be displayed.
A browser retrieves documents, constructs a document model, resolves style and schedules work before pixels can be displayed. These responsibilities overlap rather than forming one perfectly serial pipeline. This conceptual sequence separates responsibilities so you can ask which evidence supports a diagnosis. It is not an internal browser process trace.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.lifecycle({script:input.script,cssBlocking:input.css}).events.length;
}
const input={
"script": "defer",
"css": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonNavigation lifecycle
Navigation starts a new document request, but redirects and connection setup can add work before HTML arrives.
Navigation starts a new document request, but redirects and connection setup can add work before HTML arrives. A simplified lifecycle helps you identify dependencies; actual Navigation Timing describes the current document when available. Do not infer production navigation time from an authored sequence or from a localhost sample.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {redirects:input.redirects,totalModeledMs:input.redirects*input.latency+input.documentMs,kind:"simulation"};
}
const input={
"redirects": 1,
"latency": 80,
"documentMs": 120
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonResource loading
A resource can start only after it is discovered and a connection slot is available in this model.
A resource can start only after it is discovered and a connection slot is available in this model. The real browser also uses priorities, multiplexing, caches and its own scheduler. Inspect explicit dependencies and bytes before guessing why a request starts late. This example executes the documented deterministic model.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.simulateNetwork(input.resources,{mbps:8,latency:80,connections:6}).totalKb;
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBrowser processes
Browsers may separate tabs, rendering, networking and other responsibilities across processes and threads.
Browsers may separate tabs, rendering, networking and other responsibilities across processes and threads. Web content cannot enumerate privileged browser internals through ordinary page JavaScript. This authored inventory illustrates responsibilities without claiming that a particular browser created these exact processes.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.tasks.filter(t=>t.requiresMainThread).map(t=>t.name);
}
const input={
"tasks": [
{
"name": "DOM update",
"requiresMainThread": true
},
{
"name": "network transfer",
"requiresMainThread": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonDeveloper tools
Developer tools expose network, DOM, styles, console and performance evidence with privileges ordinary web pages do not share.
Developer tools expose network, DOM, styles, console and performance evidence with privileges ordinary web pages do not share. This academy teaches related reasoning using controlled local experiments and imported reports. Choose the evidence source that can answer the actual question instead of expecting a static site to remotely inspect arbitrary pages.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const tools={bytes:"Network",structure:"Elements",exception:"Console",execution:"Performance"};return tools[input.question]??"Reproduce and clarify";
}
const input={
"question": "bytes"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHTTP requests
An HTTP request has a method, target and headers, with a body when the protocol permits one.
An HTTP request has a method, target and headers, with a body when the protocol permits one. Request construction is different from sending it. Here a plain object makes the contract visible without bypassing browser origin controls or inventing a server response. The HTTP lab separately performs permitted same-origin requests.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {method:input.method,path:input.path,headers:{Accept:input.accept}};
}
const input={
"method": "GET",
"path": "/sample.json",
"accept": "application/json"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHTTP responses
A response combines status, headers and content.
A response combines status, headers and content. A completed HTTP exchange can still be an application failure, and a successful status does not validate the response body. Read both transport and application evidence. These authored response records teach the distinction before the local request experiment.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {httpOK:input.status>=200&&input.status<300,hasBody:input.status!==204&&input.status!==304};
}
const input={
"status": 200
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStatus codes
Status codes describe HTTP outcomes, not whether the complete page is correct.
Status codes describe HTTP outcomes, not whether the complete page is correct. A missing script or stylesheet may leave some visible content while breaking behavior or presentation. Group statuses to decide what to investigate next, then inspect the actual request and response rather than guessing from a code alone.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.status>=500?"server error":input.status>=400?"client/request error":input.status>=300?"redirect or revalidation":"successful response";
}
const input={
"status": 404
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHeaders
Headers communicate representation, caching and origin policy.
Headers communicate representation, caching and origin policy. Header names are case-insensitive, but their semantics require careful parsing. This example normalizes an authored header dictionary and reads a cache directive. A static fixture cannot change the real server headers by editing a JSON object.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const normalized=Object.fromEntries(Object.entries(input).map(([k,v])=>[k.toLowerCase(),v]));return normalized["cache-control"]??null;
}
const input={
"Cache-Control": "max-age=60"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRequest dependencies
A network waterfall reflects both discovery dependencies and available capacity.
A network waterfall reflects both discovery dependencies and available capacity. The model waits for named prerequisites, then shares the configured link across active transfers. Missing references and cycles are configuration errors. The browser has more complex rules, so use this controlled model to reason about one variable at a time.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.simulateNetwork(input.resources,{mbps:8,latency:0,connections:1}).requests.map(r=>r.id);
}
const input={
"resources": [
{
"id": "a",
"kb": 10,
"dependsOn": []
},
{
"id": "b",
"kb": 5,
"dependsOn": [
"a"
]
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonNetwork waterfall charts
A waterfall plots request start and duration against a shared timeline.
A waterfall plots request start and duration against a shared timeline. Long bars can reflect waiting, latency or transfer, so inspect the phases rather than equating every duration with bandwidth. This case computes actual model output from explicit bytes and latency. Imported HAR charts are labeled separately from modeled charts.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.simulateNetwork([{id:"asset",kb:input.kb,dependsOn:[]}],{mbps:8,latency:input.latency,connections:1}).modeledMs;
}
const input={
"kb": 100,
"latency": 80
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLatency
Latency is the delay before useful response data begins in a simplified model.
Latency is the delay before useful response data begins in a simplified model. It can dominate small resources and dependency chains even when bandwidth is high. Real request latency includes several possible phases; this controlled calculation deliberately uses one fixed delay so you can isolate its effect.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {kind:"simulation",chainLatencyMs:input.depth*input.latency};
}
const input={
"depth": 3,
"latency": 80
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBandwidth
Bandwidth is a rate, so units matter.
Bandwidth is a rate, so units matter. Decimal kilobytes and megabits per second differ by a factor of eight and a time conversion. This idealized transfer calculation excludes latency and browser work. It is useful for checking plausibility, not for predicting exact production loading.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.transferTime(input.kb,input.mbps);
}
const input={
"kb": 2400,
"mbps": 8
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonResource size
Large resources can dominate a byte budget even when there are few requests.
Large resources can dominate a byte budget even when there are few requests. Sort by transfer size to find the largest opportunity, then verify whether it is needed and whether quality is preserved. The opening case uses exact fictional resource sizes; the image lab separately measures supplied real files.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return [...input.resources].sort((a,b)=>b.kb-a.kb)[0].id;
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonDiagnosing failed requests
A failed resource is not diagnosed by duration alone.
A failed resource is not diagnosed by duration alone. Check status, URL, dependency and response content. Browser fetch rejects some network failures but resolves an HTTP 404 response, so code must check response.ok explicitly. This authored classification isolates the status check without inventing a live request.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.requests.filter(r=>r.status>=400).map(r=>r.id);
}
const input={
"requests": [
{
"id": "hero",
"status": 404
},
{
"id": "html",
"status": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHTML parsing
HTML parsing converts source markup into a DOM, and browser error recovery can make that DOM differ from the text you wrote.
HTML parsing converts source markup into a DOM, and browser error recovery can make that DOM differ from the text you wrote. Inspect the constructed elements rather than assuming source nesting was preserved. This example uses the actual DOM parser in the isolated browser preview; it does not measure internal parser duration.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const template=document.createElement("template");template.innerHTML=input.html;return template.content.querySelectorAll("p").length;
}
const input={
"html": "<p>One</p><p>Two</p>"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonDOM construction
The DOM is a live object tree that JavaScript can query and modify.
The DOM is a live object tree that JavaScript can query and modify. It is not a screenshot or a complete accessibility tree. This experiment constructs real nodes and checks their count. Use the rendering workspace to inspect actual computed styles, bounds, mutations and focus behavior in a controlled frame.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const list=document.createElement("ul");for(const name of input.items){const item=document.createElement("li");item.textContent=name;list.append(item);}return list.children.length;
}
const input={
"items": [
"A",
"B"
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCSSOM
CSS rules and the cascade determine computed styles after matching selectors and resolving inheritance.
CSS rules and the cascade determine computed styles after matching selectors and resolving inheritance. A stylesheet source string is not the same as the browser internal CSSOM or rendering cost. This example reads an actual computed color on a created element; timing and complete style inspection belong in the real preview experiment.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const node=document.createElement("div");node.style.color=input.color;document.body.append(node);const color=getComputedStyle(node).color;node.remove();return color;
}
const input={
"color": "rgb(20, 40, 60)"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRender trees
A conceptual render tree combines visible DOM content with resolved styles.
A conceptual render tree combines visible DOM content with resolved styles. It is not directly exposed as a full browser-internal tree to ordinary JavaScript. This authored visibility filter demonstrates why display:none excludes an item from layout, while other visibility rules need separate investigation. Do not confuse this small model with privileged developer tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.nodes.filter(n=>n.display!=="none").map(n=>n.id);
}
const input={
"nodes": [
{
"id": "a",
"display": "block"
},
{
"id": "b",
"display": "none"
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLayout and paint
Layout computes geometry; paint and compositing turn visual instructions into displayed pixels.
Layout computes geometry; paint and compositing turn visual instructions into displayed pixels. A geometry read can require current layout, but JavaScript cannot infer separate internal paint timing from a rectangle alone. This example records an authored change classification so you can predict which real experiment to run.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.property==="width"?"geometry may change":input.property==="color"?"visual appearance changes":"inspect actual browser behavior";
}
const input={
"property": "width"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonScript loading
Script discovery, download and execution are different stages.
Script discovery, download and execution are different stages. A blocking classic script can pause parsing, while defer and async alter scheduling. This conceptual sequence explains the dependency; it is not a measured network or main-thread trace. Verify actual behavior using controlled scripts or the browser developer tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.lifecycle({script:input.mode,cssBlocking:false}).events.find(e=>e.includes("script"));
}
const input={
"mode": "blocking"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonAsync and defer
Deferred classic scripts run after parsing in document order, while async scripts run when ready and do not guarantee order.
Deferred classic scripts run after parsing in document order, while async scripts run when ready and do not guarantee order. Module scripts have their own behavior, so do not generalize every classic-script rule to modules. This explicit authored classifier helps identify the guarantee before a real scheduling investigation.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {ordered:input.mode==="defer",parserBlocking:input.mode==="blocking"};
}
const input={
"mode": "defer"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMain-thread execution
Main-thread tasks can delay input handling and rendering opportunities.
Main-thread tasks can delay input handling and rendering opportunities. A static page cannot enumerate arbitrary browser tasks without supported timing entries or imported profiles. This authored task sum teaches workload reasoning; the performance studio separately measures real operations and reports supported raw long-task entries.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.tasks.reduce((sum,t)=>sum+t.ms,0);
}
const input={
"tasks": [
{
"ms": 10
},
{
"ms": 20
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLong tasks
Long tasks are observable only where the relevant API is supported, and a duration threshold does not identify a root cause by itself.
Long tasks are observable only where the relevant API is supported, and a duration threshold does not identify a root cause by itself. This example filters supplied task durations above the illustrative 50 ms boundary. These are authored data, not actual PerformanceObserver entries. Real measurements are labeled by their source.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.tasks.filter(t=>t.ms>50).map(t=>t.id);
}
const input={
"tasks": [
{
"id": "a",
"ms": 60
},
{
"id": "b",
"ms": 20
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonEvent scheduling
Synchronous code completes before queued promise callbacks, which run before the next timer task in this controlled case.
Synchronous code completes before queued promise callbacks, which run before the next timer task in this controlled case. Timing delays are not exact deadlines, and painting can occur between task opportunities. Predict the ordering, then execute the actual JavaScript rather than treating an animated event-loop diagram as evidence.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const order=["sync"];const queued=input.microtask?Promise.resolve().then(()=>order.push("microtask")):Promise.resolve();return queued.then(()=>input.timer?new Promise(resolve=>setTimeout(()=>{order.push("timer");resolve(order);},0)):order);
}
const input={
"microtask": true,
"timer": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonImage formats
An image format is a representation trade-off, not an automatic guarantee of fewer bytes or equal quality.
An image format is a representation trade-off, not an automatic guarantee of fewer bytes or equal quality. Compare actual encoded size, dimensions and visual fidelity for the intended use. This calculation compares supplied file-byte records; the image studio loads the actual local PNG fixtures and measures bytes and decode intervals.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {savedBytes:input.before-input.after,smaller:input.after<input.before};
}
const input={
"before": 2400000,
"after": 180000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonResponsive images
Responsive images give the browser candidates and an estimate of rendered size.
Responsive images give the browser candidates and an estimate of rendered size. CSS width times device pixel ratio is a useful selection model, but the browser may apply additional heuristics and cache choices. Inspect currentSrc in a real page to know which resource was used. This calculation is explicitly educational.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.responsiveChoice(input).selected;
}
const input={
"cssWidth": 300,
"dpr": 2,
"candidates": [
{
"width": 320,
"src": "small"
},
{
"width": 640,
"src": "medium"
},
{
"width": 1280,
"src": "large"
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonFont loading
Fonts affect text appearance, fallback behavior and possible shifts.
Fonts affect text appearance, fallback behavior and possible shifts. A preload or font-display choice needs a matching resource and a reason, not blanket use. This model separates whether text can be shown immediately from whether a custom font has arrived. Real font readiness can be inspected with document.fonts where supported.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {display:input.loaded?"custom font":input.policy==="swap"?"fallback text":"font policy may delay text",kind:"conceptual model"};
}
const input={
"loaded": false,
"policy": "swap"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCompression
Compression reduces transferred representation bytes for suitable content, but already compressed formats may improve little or even grow.
Compression reduces transferred representation bytes for suitable content, but already compressed formats may improve little or even grow. Compare encoded and decoded sizes without mixing units. The local CompressionStream experiment performs actual gzip on supplied text; it does not prove that a host sends Content-Encoding correctly.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {ratio:input.original?input.compressed/input.original:null,savedBytes:input.original-input.compressed};
}
const input={
"original": 1000,
"compressed": 250
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMinimizing unnecessary resources
Unused or unnecessary resources consume bytes even if their individual sizes look small.
Unused or unnecessary resources consume bytes even if their individual sizes look small. Remove a resource only after verifying that the relevant feature still works. This deterministic selection uses authored need flags; it does not infer code coverage. A real coverage investigation requires representative interaction and appropriate tooling.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.resources.filter(r=>r.needed).reduce((sum,r)=>sum+r.kb,0);
}
const input={
"resources": [
{
"kb": 10,
"needed": true
},
{
"kb": 20,
"needed": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStylesheet loading
Stylesheets can affect rendering when their media conditions match.
Stylesheets can affect rendering when their media conditions match. A resource may be fetched without blocking the current presentation in the same way as a matching stylesheet. This conceptual filter uses explicit media matches; it does not measure the browser stylesheet scheduler. Verify actual requests and computed styles in the rendering lab.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.sheets.filter(s=>s.matches).map(s=>s.id);
}
const input={
"sheets": [
{
"id": "screen",
"matches": true
},
{
"id": "print",
"matches": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLayout costs
Layout costs depend on the affected structure and forced synchronization, not simply on the number of CSS declarations.
Layout costs depend on the affected structure and forced synchronization, not simply on the number of CSS declarations. Interleaving writes and geometry reads may cause avoidable work. This authored count models a repeated-read pattern; the DOM benchmark measures an actual connected update plus geometry read without inventing separate paint timings.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {potentialReadWritePairs:input.rows,batchedReadWriteGroups:input.rows?1:0,kind:"conceptual model"};
}
const input={
"rows": 100
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRendering changes
A rendering change can alter layout, visual appearance or composition depending on the property and context.
A rendering change can alter layout, visual appearance or composition depending on the property and context. Transform animations often avoid changing normal-flow geometry, but performance must still be measured. This example classifies an intended change as a hypothesis. The actual preview exposes computed styles and geometry for verification.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["width","height","margin"].includes(input.property)?"investigate layout":"inspect paint/compositing and visual result";
}
const input={
"property": "width"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonResponsive layout problems
Responsive failures often result from content wider than the available viewport, inflexible children or missing wrapping.
Responsive failures often result from content wider than the available viewport, inflexible children or missing wrapping. A breakpoint alone is not a complete mobile design. This calculation identifies an authored overflow condition. The responsive workspace also measures actual element rectangles and document scroll width in a controlled iframe.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {overflow:input.content>input.viewport,extra:Math.max(0,input.content-input.viewport)};
}
const input={
"content": 900,
"viewport": 375
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonAnimation performance
Animation should preserve usability and respect reduced-motion preferences.
Animation should preserve usability and respect reduced-motion preferences. Smooth-looking movement does not establish low rendering cost. This policy uses a declared preference to choose a static alternative. Inspect the actual animation, keyboard behavior and local measurements separately rather than claiming a transform is always fast.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {animate:!input.reduceMotion,durationMs:input.reduceMotion?0:input.duration};
}
const input={
"reduceMotion": true,
"duration": 300
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMeasuring execution
Execution measurements need a defined workload, repeated samples and a correctness check.
Execution measurements need a defined workload, repeated samples and a correctness check. A single duration can be dominated by warm-up or noise. Median summarizes the middle observation without inventing a production result. This operation uses supplied samples; the performance studio obtains separate actual browser samples with alternating A/B order.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.median(input.samples);
}
const input={
"samples": [
3,
1,
2
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonExpensive loops
Expensive loops should be investigated with a realistic workload and an independent expected result.
Expensive loops should be investigated with a realistic workload and an independent expected result. A mathematically equivalent formula can be faster, but correctness and numeric range matter. This implementation computes an actual loop result. Benchmark both implementations locally and inspect repeated medians before declaring an improvement.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
let sum=0;for(let i=1;i<=input.n;i++)sum+=i;return sum;
}
const input={
"n": 10
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRedundant work
Redundant work can be removed by computing a reusable result once, but caching has invalidation and memory trade-offs.
Redundant work can be removed by computing a reusable result once, but caching has invalidation and memory trade-offs. This example demonstrates actual Set-based deduplication. It proves the output for the supplied array, not that a particular data structure is always faster. The benchmark includes necessary setup when comparing implementations.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return [...new Set(input.items)];
}
const input={
"items": [
"a",
"a",
"b"
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonDOM update patterns
Batching DOM construction can reduce repeated connected updates, but the effect depends on the page and browser.
Batching DOM construction can reduce repeated connected updates, but the effect depends on the page and browser. A DocumentFragment is a useful structure, not a guaranteed optimization. This example creates real nodes and verifies the resulting child count. The actual performance lab times equivalent connected implementations separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const host=document.createElement("ul"),fragment=document.createDocumentFragment();for(const text of input.items){const li=document.createElement("li");li.textContent=text;fragment.append(li);}host.append(fragment);return host.children.length;
}
const input={
"items": [
"a",
"b",
"c"
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonOptimization verification
An optimization is not successful if it changes the required behavior.
An optimization is not successful if it changes the required behavior. Compare independent correctness results before comparing timings, then check whether the change is larger than normal variation. This exact regression calculation works on supplied samples and an explicit tolerance. It does not fabricate browser measurements or guarantee field improvement.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.regression(input).regression;
}
const input={
"before": [
10,
10,
10
],
"after": [
12,
12,
12
],
"tolerance": 5,
"equivalent": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLargest Contentful Paint
Largest Contentful Paint concerns the largest qualifying visible content candidate in a navigation.
Largest Contentful Paint concerns the largest qualifying visible content candidate in a navigation. Raw observer entries, local image fetch time and field percentiles are different evidence. This exercise selects a supplied candidate by time; it does not claim an official current-page LCP. The vitals workspace feature-detects actual observer support and labels raw entries.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.candidates.at(-1)?.time??null;
}
const input={
"candidates": [
{
"time": 100
},
{
"time": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonInteraction to Next Paint
Interaction to Next Paint depends on actual interactions across the page lifecycle.
Interaction to Next Paint depends on actual interactions across the page lifecycle. A handler duration, rAF interval or single raw event entry is not a finalized page INP value. This supplied-data calculation exposes handler processing time only. The academy deliberately avoids labeling this simplified number as official INP.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {processingMs:input.end-input.start,metric:"supplied handler interval, not INP"};
}
const input={
"start": 10,
"end": 30
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCumulative Layout Shift
Layout shifts describe unexpected movement of visible content.
Layout shifts describe unexpected movement of visible content. An illustrative impact-times-distance product is only one contribution, not the complete CLS session-window algorithm. Recent user input and lifecycle rules matter. The actual local demonstration reports supported raw LayoutShift entries with hadRecentInput, while clearly avoiding a fabricated page CLS.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.shiftScore(input.impact,input.distance).score;
}
const input={
"impact": 0.5,
"distance": 0.2
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonInterpreting measurements
Measurements require context: evidence kind, workload, browser, cache state and timing boundaries.
Measurements require context: evidence kind, workload, browser, cache state and timing boundaries. Mixing a modeled result with a local measurement produces an invalid comparison. This operation rejects that mixture explicitly. A useful report states what was measured and what remains unverified rather than presenting a convenient score.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.compare(input.before,input.after).differenceMs;
}
const input={
"before": {
"kind": "simulation",
"modeledMs": 300
},
"after": {
"kind": "simulation",
"modeledMs": 100
}
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonField versus laboratory data
Field data summarizes real user experiences, while lab data describes a controlled scenario.
Field data summarizes real user experiences, while lab data describes a controlled scenario. A local demonstration cannot establish a production percentile. This classifier makes the provenance explicit so a report does not silently compare incomparable evidence. Use representative field monitoring separately when evaluating a real deployment.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.source==="real users"?"field observations":input.source==="controlled run"?"lab observations":"declare evidence source";
}
const input={
"source": "real users"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBrowser caching
Browser caching can avoid a network body transfer, but freshness and revalidation are separate decisions.
Browser caching can avoid a network body transfer, but freshness and revalidation are separate decisions. This deterministic model uses an age and max-age boundary. It is not evidence that a resource was cached by the current browser. The real service worker demonstration is isolated to its own folder and must be tested separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.cacheDecision(input).source;
}
const input={
"age": 10,
"maxAge": 60,
"online": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCache-control
Cache-Control directives communicate storage and reuse policy.
Cache-Control directives communicate storage and reuse policy. no-store is different from no-cache: the latter normally requires validation before reuse rather than forbidding storage. This simple directive reader demonstrates exact distinctions without acting as a complete HTTP caching implementation. Inspect actual response headers in a permitted request.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.header.includes("no-store")?"do not store":input.header.includes("no-cache")?"revalidate before reuse":"inspect freshness directives";
}
const input={
"header": "no-store"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRevalidation
ETag revalidation can return a 304 response while reusing a cached representation.
ETag revalidation can return a 304 response while reusing a cached representation. That still involves a network validation round trip. This deterministic model distinguishes fresh reuse, unchanged revalidation and a changed response. Real server behavior, Vary and additional cache directives need a more complete investigation.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.cacheDecision(input).status;
}
const input={
"age": 100,
"maxAge": 60,
"etag": "v1",
"serverEtag": "v1"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonService workers
Service workers have registration, installation, activation and control boundaries.
Service workers have registration, installation, activation and control boundaries. Registering one does not immediately guarantee that the current page is controlled or that every resource is available offline. This authored state policy illustrates the distinction. The separate real demo registers only within its own folder and provides explicit cleanup.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {canServeOffline:input.controlled&&input.cached,kind:"service worker concept model"};
}
const input={
"controlled": true,
"cached": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonInvestigating stale resources
Stale resources can come from multiple cache layers, including a service worker.
Stale resources can come from multiple cache layers, including a service worker. A hard refresh is not a durable versioning strategy. This explicit version comparison identifies a supplied mismatch without remotely clearing caches. Use the isolated cache experiment to inspect and remove only the academy-owned demo data.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {stale:input.cachedVersion!==input.expectedVersion};
}
const input={
"cachedVersion": "v1",
"expectedVersion": "v2"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonConsole errors
A console error is evidence of a failure, not an explanation of its cause.
A console error is evidence of a failure, not an explanation of its cause. Reproduce the operation, inspect the actual message and narrow the input. This example creates a real Error and exposes its name/message while leaving variable stack locations out of deterministic grading. The editor can show actual thrown stacks separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const error=new TypeError(input.message);return {name:error.name,message:error.message};
}
const input={
"message": "Expected a record"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStack traces
Stack traces describe an observed call path and may refer to bundled or transformed source locations.
Stack traces describe an observed call path and may refer to bundled or transformed source locations. They are not a debugger or a breakpoint controller. This parser uses supplied stack text to practice reading frames. The actual source runtime also reports real exceptions; investigate source mappings separately for production builds.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.stack.split("\n").filter(line=>line.trim().startsWith("at ")).length;
}
const input={
"stack": "Error: failed\n at a (a.js:1)\n at b (b.js:2)"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBreakpoints
Breakpoints pause execution inside browser developer tools, which a normal static page cannot reproduce with the same privileges.
Breakpoints pause execution inside browser developer tools, which a normal static page cannot reproduce with the same privileges. This authored state capture illustrates what information to inspect at a suspected line. It is not an actual breakpoint API. Use your browser developer tools for genuine stepping and scope inspection.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {line:input.line,locals:{quantity:input.quantity,price:input.price},expectedTotal:input.quantity*input.price};
}
const input={
"line": 4,
"quantity": 3,
"price": 25
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonNetwork failures
Fetch resolves for HTTP error responses, so check status before parsing or using data.
Fetch resolves for HTTP error responses, so check status before parsing or using data. Network rejection, HTTP failure and invalid JSON are different layers. This deterministic policy examines supplied status/body evidence; the HTTP inspector makes separate real same-origin requests and labels their actual headers and errors.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.status>=400?"check HTTP failure":input.validJSON?"validate application data":"repair or reject response syntax";
}
const input={
"status": 404,
"validJSON": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonReproducing bugs
A reproducible bug report states the exact input, action, expected behavior and actual behavior.
A reproducible bug report states the exact input, action, expected behavior and actual behavior. Without those facts, a proposed fix is a hypothesis. This completeness checker verifies report structure only; it cannot establish that the reported reproduction is accurate. Execute the steps and attach labeled evidence in the audit builder.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["input","action","expected","actual"].filter(key=>!input[key]);
}
const input={
"input": "R1",
"action": "Run",
"expected": "Row",
"actual": "Error"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCookies
Cookies have scope, expiry and security attributes, and HttpOnly cookies cannot be read through document.cookie.
Cookies have scope, expiry and security attributes, and HttpOnly cookies cannot be read through document.cookie. This conceptual filter shows which authored cookies a script could inspect. The storage workspace touches only its own fictional cookie and never claims to expose protected browser or server storage.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.cookies.filter(c=>!c.httpOnly).map(c=>c.name);
}
const input={
"cookies": [
{
"name": "demo",
"httpOnly": false
},
{
"name": "session",
"httpOnly": true
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLocalStorage
localStorage stores strings synchronously and is scoped to an origin.
localStorage stores strings synchronously and is scoped to an origin. Serializing data does not make it durable forever or suitable for secrets. This example performs an actual JSON round trip for a fictional value. The storage lab separately writes, reads and resets only an academy-owned localStorage key.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return JSON.parse(JSON.stringify(input.value));
}
const input={
"value": {
"id": 1,
"name": "Ari"
}
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonSessionStorage
sessionStorage is associated with an origin and a browsing session, so its lifetime differs from localStorage.
sessionStorage is associated with an origin and a browsing session, so its lifetime differs from localStorage. Browser restoration and privacy settings can affect practical behavior. This authored lifetime classifier explains the intended distinction; use the controlled storage workspace to inspect actual values rather than expecting cross-tab storage inspection.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.store==="sessionStorage"?"session-scoped":input.store==="localStorage"?"origin-scoped until removed":"inspect API lifetime";
}
const input={
"store": "sessionStorage"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonIndexedDB
IndexedDB uses asynchronous transactions.
IndexedDB uses asynchronous transactions. A successful request is not the same as a completed write transaction, so durable-save confirmation belongs after transaction completion. This conceptual state gate identifies that boundary. The actual academy persistence and storage experiment use real IndexedDB transactions and handle errors explicitly.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {saved:input.transactionState==="complete",kind:"transaction boundary model"};
}
const input={
"transactionState": "request-success"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStorage failures and privacy
Storage can fail because of quotas, privacy settings, unavailable APIs or invalid serialized data.
Storage can fail because of quotas, privacy settings, unavailable APIs or invalid serialized data. Never label a write successful before checking the actual result. This explicit recovery policy preserves a draft and recommends export on failure. The real storage lab reports actual exceptions without manufacturing a quota test that fills the browser.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {retainDraft:true,action:input.success?"saved":"export backup and inspect storage error"};
}
const input={
"success": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonSemantic structure
Semantic structure gives meaning to headings, landmarks and form controls.
Semantic structure gives meaning to headings, landmarks and form controls. Automated checks can identify missing pieces, but a plausible tag list does not certify accessibility. This example inspects actual created headings in a local DOM fragment. The accessibility workspace adds real focus events and guided manual keyboard review.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const template=document.createElement("template");template.innerHTML=input.html;return [...template.content.querySelectorAll("h1,h2,h3")].map(h=>h.tagName);
}
const input={
"html": "<h1>Title</h1><h2>Section</h2>"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonContrast
Contrast is a calculable relationship between specified opaque colors, but complete readability also depends on actual backgrounds, font size and state.
Contrast is a calculable relationship between specified opaque colors, but complete readability also depends on actual backgrounds, font size and state. This implementation calculates relative luminance and reports the normal-text AA threshold. It is not a complete accessibility compliance score or an automatic judgment of every rendered element.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.contrast(input.foreground,input.background).normalTextAA;
}
const input={
"foreground": "#000000",
"background": "#ffffff"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonKeyboard navigation
Keyboard navigation depends on real focusable controls, meaningful order and operable interactions.
Keyboard navigation depends on real focusable controls, meaningful order and operable interactions. A mouse-only demonstration cannot establish keyboard usability. This authored control inventory identifies a known missing keyboard handler in a custom pattern. The actual preview lets learners tab through native controls and inspect focus events.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.controls.filter(c=>c.custom&&!c.keyboard).map(c=>c.id);
}
const input={
"controls": [
{
"id": "menu",
"custom": true,
"keyboard": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonFocus management
Focus management should move users predictably when opening and closing interfaces.
Focus management should move users predictably when opening and closing interfaces. Removing a focused control without a sensible destination can strand keyboard users. This policy describes the expected return target for a dialog; the project source uses native dialog behavior and an explicit close-focus handler that learners can test.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {onCloseFocus:input.openerPresent?input.openerId:"choose a logical surviving control"};
}
const input={
"openerPresent": true,
"openerId": "open"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonAccessible interface behavior
Accessible behavior requires labels, states, error messages and real interaction, not merely ARIA attributes.
Accessible behavior requires labels, states, error messages and real interaction, not merely ARIA attributes. This targeted automated check identifies an input without a programmatic label in an actual DOM fragment. It is deliberately narrower than a full accessible-name algorithm or compliance audit. Manual review remains essential.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const host=document.createElement("div");host.innerHTML=input.html;document.body.append(host);const missing=[...host.querySelectorAll("input")].filter(el=>!el.labels?.length&&!el.getAttribute("aria-label")).length;host.remove();return missing;
}
const input={
"html": "<input id=\"name\">"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonViewport problems
A viewport declaration influences mobile layout, but it does not fix fixed-width content or inaccessible controls.
A viewport declaration influences mobile layout, but it does not fix fixed-width content or inaccessible controls. This authored configuration check spots a missing or incorrect width directive. The responsive lab controls an actual iframe viewport and reports real geometry; those observations remain local experiments rather than a full device test matrix.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {mobileWidth:input.content.includes("width=device-width")};
}
const input={
"content": "width=device-width,initial-scale=1"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHorizontal overflow
Horizontal overflow can come from a single long word, fixed-width child, grid track or positioned element.
Horizontal overflow can come from a single long word, fixed-width child, grid track or positioned element. Measure actual rectangles and document width before changing a breakpoint. This supplied geometry calculation identifies out-of-bounds elements. The responsive workspace obtains separate actual browser geometry and lets you edit the offending CSS.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.elements.filter(el=>el.right>input.viewport||el.left<0).map(el=>el.id);
}
const input={
"viewport": 375,
"elements": [
{
"id": "wide",
"left": 0,
"right": 900
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonTouch interaction
Touch usability depends on target size, spacing, labels and behavior across input methods.
Touch usability depends on target size, spacing, labels and behavior across input methods. A numeric target check is a useful investigation aid, not complete compliance. This authored size filter flags controls below a chosen practice threshold. Verify actual CSS pixels, alternatives and applicable requirements in a real review.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.targets.filter(t=>t.width<input.minimum||t.height<input.minimum).map(t=>t.id);
}
const input={
"minimum": 24,
"targets": [
{
"id": "tiny",
"width": 16,
"height": 16
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonResource selection
Resource selection can change with rendered size and pixel density, so a desktop screenshot is not enough to verify mobile image use.
Resource selection can change with rendered size and pixel density, so a desktop screenshot is not enough to verify mobile image use. This explicitly simplified model chooses a width candidate. In the actual image experiment inspect dimensions and bytes; in a real site inspect currentSrc rather than assuming the model matches browser heuristics.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.responsiveChoice(input).targetPixels;
}
const input={
"cssWidth": 375,
"dpr": 2,
"candidates": [
{
"width": 800,
"src": "hero"
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMobile testing
Mobile testing should include actual interactions, zoom, focus and representative connection/device conditions.
Mobile testing should include actual interactions, zoom, focus and representative connection/device conditions. An iframe width is a controlled layout experiment, not a complete phone emulation. This checklist returns missing review evidence. Do not mark a mobile investigation complete merely because a narrow preview looks attractive.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["keyboard","overflow","touch","content"].filter(key=>input[key]!==true);
}
const input={
"keyboard": true,
"overflow": true,
"touch": true,
"content": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonPerformance budgets
A performance budget is an explicit constraint tied to user needs and evidence, not an arbitrary universal score.
A performance budget is an explicit constraint tied to user needs and evidence, not an arbitrary universal score. Sum resource sizes and compare with a stated limit, then verify feature correctness and actual performance separately. This calculation uses the fictional opening resources and does not report live production bytes.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.budget(input.resources,input.limit).within;
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
],
"limit": 1000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonSEO technical foundations
Technical SEO foundations include indexable content, meaningful titles, descriptions and canonical URLs.
Technical SEO foundations include indexable content, meaningful titles, descriptions and canonical URLs. A static checklist cannot predict ranking or guarantee that a search engine indexed a page. This structural review checks supplied metadata. The academy also ships full printable lessons so educational content does not depend entirely on client-side rendering.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return [!input.title?"missing title":null,!input.description?"missing description":null,!input.canonical?"missing canonical":null].filter(Boolean);
}
const input={
"title": "Guide",
"description": "Learn",
"canonical": "https://example.test/guide"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonSecurity-related browser errors
Security-related browser errors can involve mixed content, CSP, origin checks or blocked credentials.
Security-related browser errors can involve mixed content, CSP, origin checks or blocked credentials. Do not bypass a protection just to make a request appear successful. This explicit policy identifies an insecure subresource on an HTTPS page. It is a conceptual check, not a full security scanner or a CORS bypass.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {mixedContent:input.page.startsWith("https:")&&input.resource.startsWith("http:")};
}
const input={
"page": "https://example.test",
"resource": "http://example.test/a.js"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonRegression testing
Regression testing should preserve both behavior and comparable measurement conditions.
Regression testing should preserve both behavior and comparable measurement conditions. A slower median can be a useful signal only after correctness and noise are considered. This supplied-sample comparison uses an explicit tolerance. Real monitoring needs repeated representative runs and must not be fabricated from a one-time localhost observation.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.regression(input).regression;
}
const input={
"before": [
10,
11,
9
],
"after": [
20,
21,
19
],
"tolerance": 10,
"equivalent": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCommunicating findings
A useful finding connects evidence to a user impact, reproducible steps, a suggested fix and a verification method.
A useful finding connects evidence to a user impact, reproducible steps, a suggested fix and a verification method. Severity is a judgment that should be explained, not manufactured by an arbitrary AI score. This exact ordering uses authored severity labels. Review each label and retain the source of its evidence in the audit report.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.prioritize(input.findings).map(f=>f.id);
}
const input={
"findings": [
{
"id": "a",
"severity": "low"
},
{
"id": "b",
"severity": "high"
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonPlanning an audit
Plan an audit around scope, consent, user journeys and available evidence.
Plan an audit around scope, consent, user journeys and available evidence. A static academy cannot remotely inspect arbitrary sites or bypass origin protections. This completeness check identifies missing planning fields before you collect data. Use only appropriately sanitized imports and controlled local cases unless you have authorization and suitable tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["scope","journey","baseline","verification"].filter(key=>!input[key]);
}
const input={
"scope": "Local demo",
"journey": "Load page",
"baseline": "Model v1",
"verification": "Repeat same case"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonEstablishing a baseline
A baseline records conditions as well as numbers.
A baseline records conditions as well as numbers. Without workload, cache policy and evidence kind, a before-and-after comparison can be misleading. This operation creates an explicit supplied-data baseline record. The real measurement tools retain raw samples and state their timing boundaries so another reviewer can reproduce the experiment.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {kind:input.kind,workload:input.workload,cache:input.cache,baseline:input.value};
}
const input={
"kind": "simulation",
"workload": "opening case",
"cache": "none modeled",
"value": 3005
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonPrioritizing findings
Prioritization should consider severity, user impact, evidence quality and implementation effort.
Prioritization should consider severity, user impact, evidence quality and implementation effort. The largest byte count is not always the most consequential defect. This transparent ratio uses authored estimates and must not be presented as objective truth. The professional report keeps the justification and evidence kind visible beside each finding.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return [...input.findings].sort((a,b)=>b.impact/b.effort-a.impact/a.effort).map(f=>f.id);
}
const input={
"findings": [
{
"id": "a",
"impact": 10,
"effort": 5
},
{
"id": "b",
"impact": 6,
"effort": 1
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonImplementing improvements
Implement one change at a time when possible, preserve the original and rerun the same scenario.
Implement one change at a time when possible, preserve the original and rerun the same scenario. The opening optimization replaces only the hero transfer size in the model. This verifies the exact byte reduction while leaving other resources intact. Actual image quality and real loading are separate checks in the local experiment.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.optimizeHero(input.resources,input.kb).reduce((sum,r)=>sum+r.kb,0);
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
],
"kb": 180
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonPresenting a verified final report
A verified final report distinguishes what changed, how it was tested and what remains uncertain.
A verified final report distinguishes what changed, how it was tested and what remains uncertain. Do not claim production success from a simulation or local sample. This report summary counts findings with actual recorded verification flags. Read the attached evidence and human explanations before interpreting completion as demonstrated improvement.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {total:input.findings.length,verified:input.findings.filter(f=>f.verified===true).length,kinds:[...new Set(input.findings.map(f=>f.kind))]};
}
const input={
"findings": [
{
"verified": true,
"kind": "simulation"
},
{
"verified": false,
"kind": "manual observation"
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonVerification
Reproducing the stated check and preserving evidence, rather than declaring success from a plausible explanation.
Reproducing the stated check and preserving evidence, rather than declaring success from a plausible explanation. Plan an audit around scope, consent, user journeys and available evidence. A static academy cannot remotely inspect arbitrary sites or bypass origin protections. This completeness check identifies missing planning fields before you collect data. Use only appropriately sanitized imports and controlled local cases unless you have authorization and suitable tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["scope","journey","baseline","verification"].filter(key=>!input[key]);
}
const input={
"scope": "Local demo",
"journey": "Load page",
"baseline": "Model v1",
"verification": "Repeat same case"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBaseline
A recorded initial workload, conditions and result used for a controlled comparison.
A recorded initial workload, conditions and result used for a controlled comparison. Plan an audit around scope, consent, user journeys and available evidence. A static academy cannot remotely inspect arbitrary sites or bypass origin protections. This completeness check identifies missing planning fields before you collect data. Use only appropriately sanitized imports and controlled local cases unless you have authorization and suitable tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return ["scope","journey","baseline","verification"].filter(key=>!input[key]);
}
const input={
"scope": "Local demo",
"journey": "Load page",
"baseline": "Model v1",
"verification": "Repeat same case"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonField versus lab
Real-user observations and controlled scenarios answer different questions and must remain labeled.
Real-user observations and controlled scenarios answer different questions and must remain labeled. A performance budget is an explicit constraint tied to user needs and evidence, not an arbitrary universal score. Sum resource sizes and compare with a stated limit, then verify feature correctness and actual performance separately. This calculation uses the fictional opening resources and does not report live production bytes.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.budget(input.resources,input.limit).within;
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
],
"limit": 1000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonPerformance budget
An explicit constraint such as total transfer KB, with a stated user purpose and assumptions.
An explicit constraint such as total transfer KB, with a stated user purpose and assumptions. A performance budget is an explicit constraint tied to user needs and evidence, not an arbitrary universal score. Sum resource sizes and compare with a stated limit, then verify feature correctness and actual performance separately. This calculation uses the fictional opening resources and does not report live production bytes.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.budget(input.resources,input.limit).within;
}
const input={
"resources": [
{
"id": "html",
"type": "html",
"kb": 35,
"dependsOn": [],
"status": 200
},
{
"id": "css",
"type": "css",
"kb": 80,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "javascript",
"type": "script",
"kb": 240,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "hero",
"type": "image",
"kb": 2400,
"dependsOn": [
"html"
],
"status": 200
},
{
"id": "fonts",
"type": "font",
"kb": 90,
"dependsOn": [
"html"
],
"status": 200
}
],
"limit": 1000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCSS pixel
A layout unit; it is not necessarily one physical display pixel.
A layout unit; it is not necessarily one physical display pixel. A viewport declaration influences mobile layout, but it does not fix fixed-width content or inaccessible controls. This authored configuration check spots a missing or incorrect width directive. The responsive lab controls an actual iframe viewport and reports real geometry; those observations remain local experiments rather than a full device test matrix.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {mobileWidth:input.content.includes("width=device-width")};
}
const input={
"content": "width=device-width,initial-scale=1"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonFocus indicator
The perceptible visual indication of the currently focused control; actual usability requires manual review.
The perceptible visual indication of the currently focused control; actual usability requires manual review. Semantic structure gives meaning to headings, landmarks and form controls. Automated checks can identify missing pieces, but a plausible tag list does not certify accessibility. This example inspects actual created headings in a local DOM fragment. The accessibility workspace adds real focus events and guided manual keyboard review.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const template=document.createElement("template");template.innerHTML=input.html;return [...template.content.querySelectorAll("h1,h2,h3")].map(h=>h.tagName);
}
const input={
"html": "<h1>Title</h1><h2>Section</h2>"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonProgrammatic label
A name associated with a control through supported semantics, distinct from nearby decorative text.
A name associated with a control through supported semantics, distinct from nearby decorative text. Semantic structure gives meaning to headings, landmarks and form controls. Automated checks can identify missing pieces, but a plausible tag list does not certify accessibility. This example inspects actual created headings in a local DOM fragment. The accessibility workspace adds real focus events and guided manual keyboard review.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const template=document.createElement("template");template.innerHTML=input.html;return [...template.content.querySelectorAll("h1,h2,h3")].map(h=>h.tagName);
}
const input={
"html": "<h1>Title</h1><h2>Section</h2>"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonTransaction
An asynchronous IndexedDB unit whose completion, not only a request success, confirms a committed write.
An asynchronous IndexedDB unit whose completion, not only a request success, confirms a committed write. Cookies have scope, expiry and security attributes, and HttpOnly cookies cannot be read through document.cookie. This conceptual filter shows which authored cookies a script could inspect. The storage workspace touches only its own fictional cookie and never claims to expose protected browser or server storage.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.cookies.filter(c=>!c.httpOnly).map(c=>c.name);
}
const input={
"cookies": [
{
"name": "demo",
"httpOnly": false
},
{
"name": "session",
"httpOnly": true
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonOrigin
A scheme, host and port combination that participates in browser storage/security boundaries.
A scheme, host and port combination that participates in browser storage/security boundaries. Cookies have scope, expiry and security attributes, and HttpOnly cookies cannot be read through document.cookie. This conceptual filter shows which authored cookies a script could inspect. The storage workspace touches only its own fictional cookie and never claims to expose protected browser or server storage.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.cookies.filter(c=>!c.httpOnly).map(c=>c.name);
}
const input={
"cookies": [
{
"name": "demo",
"httpOnly": false
},
{
"name": "session",
"httpOnly": true
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonBreakpoint
A privileged developer-tools pause location; this static academy does not pretend to control the browser debugger.
A privileged developer-tools pause location; this static academy does not pretend to control the browser debugger. A console error is evidence of a failure, not an explanation of its cause. Reproduce the operation, inspect the actual message and narrow the input. This example creates a real Error and exposes its name/message while leaving variable stack locations out of deterministic grading. The editor can show actual thrown stacks separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const error=new TypeError(input.message);return {name:error.name,message:error.message};
}
const input={
"message": "Expected a record"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStack trace
Observed call frames associated with an error; bundled source can affect the displayed locations.
Observed call frames associated with an error; bundled source can affect the displayed locations. A console error is evidence of a failure, not an explanation of its cause. Reproduce the operation, inspect the actual message and narrow the input. This example creates a real Error and exposes its name/message while leaving variable stack locations out of deterministic grading. The editor can show actual thrown stacks separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const error=new TypeError(input.message);return {name:error.name,message:error.message};
}
const input={
"message": "Expected a record"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonETag
A representation validator that can support conditional revalidation and a 304 response.
A representation validator that can support conditional revalidation and a 304 response. Browser caching can avoid a network body transfer, but freshness and revalidation are separate decisions. This deterministic model uses an age and max-age boundary. It is not evidence that a resource was cached by the current browser. The real service worker demonstration is isolated to its own folder and must be tested separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.cacheDecision(input).source;
}
const input={
"age": 10,
"maxAge": 60,
"online": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonmax-age
An HTTP cache freshness directive expressed in seconds.
An HTTP cache freshness directive expressed in seconds. Browser caching can avoid a network body transfer, but freshness and revalidation are separate decisions. This deterministic model uses an age and max-age boundary. It is not evidence that a resource was cached by the current browser. The real service worker demonstration is isolated to its own folder and must be tested separately.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.cacheDecision(input).source;
}
const input={
"age": 10,
"maxAge": 60,
"online": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonCLS
Cumulative Layout Shift, which uses eligibility and session-window rules beyond one impact-times-distance example.
Cumulative Layout Shift, which uses eligibility and session-window rules beyond one impact-times-distance example. Largest Contentful Paint concerns the largest qualifying visible content candidate in a navigation. Raw observer entries, local image fetch time and field percentiles are different evidence. This exercise selects a supplied candidate by time; it does not claim an official current-page LCP. The vitals workspace feature-detects actual observer support and labels raw entries.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.candidates.at(-1)?.time??null;
}
const input={
"candidates": [
{
"time": 100
},
{
"time": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonINP
Interaction to Next Paint, a lifecycle responsiveness metric; a single handler/rAF interval is not finalized page INP.
Interaction to Next Paint, a lifecycle responsiveness metric; a single handler/rAF interval is not finalized page INP. Largest Contentful Paint concerns the largest qualifying visible content candidate in a navigation. Raw observer entries, local image fetch time and field percentiles are different evidence. This exercise selects a supplied candidate by time; it does not claim an official current-page LCP. The vitals workspace feature-detects actual observer support and labels raw entries.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.candidates.at(-1)?.time??null;
}
const input={
"candidates": [
{
"time": 100
},
{
"time": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLCP candidate
A raw largest-contentful-paint observation for a document, not automatically a field percentile.
A raw largest-contentful-paint observation for a document, not automatically a field percentile. Largest Contentful Paint concerns the largest qualifying visible content candidate in a navigation. Raw observer entries, local image fetch time and field percentiles are different evidence. This exercise selects a supplied candidate by time; it does not claim an official current-page LCP. The vitals workspace feature-detects actual observer support and labels raw entries.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.candidates.at(-1)?.time??null;
}
const input={
"candidates": [
{
"time": 100
},
{
"time": 200
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonWarm-up
Unreported preparation runs intended to reduce first-run effects; not a guarantee that noise is gone.
Unreported preparation runs intended to reduce first-run effects; not a guarantee that noise is gone. Execution measurements need a defined workload, repeated samples and a correctness check. A single duration can be dominated by warm-up or noise. Median summarizes the middle observation without inventing a production result. This operation uses supplied samples; the performance studio obtains separate actual browser samples with alternating A/B order.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.median(input.samples);
}
const input={
"samples": [
3,
1,
2
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMedian
The middle value of sorted samples, or the mean of the two middle values.
The middle value of sorted samples, or the mean of the two middle values. Execution measurements need a defined workload, repeated samples and a correctness check. A single duration can be dominated by warm-up or noise. Median summarizes the middle observation without inventing a production result. This operation uses supplied samples; the performance studio obtains separate actual browser samples with alternating A/B order.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.median(input.samples);
}
const input={
"samples": [
3,
1,
2
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonTransform
A visual transformation that may avoid changing normal-flow geometry, but is not a guaranteed performance win.
A visual transformation that may avoid changing normal-flow geometry, but is not a guaranteed performance win. Stylesheets can affect rendering when their media conditions match. A resource may be fetched without blocking the current presentation in the same way as a matching stylesheet. This conceptual filter uses explicit media matches; it does not measure the browser stylesheet scheduler. Verify actual requests and computed styles in the rendering lab.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.sheets.filter(s=>s.matches).map(s=>s.id);
}
const input={
"sheets": [
{
"id": "screen",
"matches": true
},
{
"id": "print",
"matches": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonForced layout
A geometry read that requires the browser to bring layout up to date after relevant changes.
A geometry read that requires the browser to bring layout up to date after relevant changes. Stylesheets can affect rendering when their media conditions match. A resource may be fetched without blocking the current presentation in the same way as a matching stylesheet. This conceptual filter uses explicit media matches; it does not measure the browser stylesheet scheduler. Verify actual requests and computed styles in the rendering lab.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return input.sheets.filter(s=>s.matches).map(s=>s.id);
}
const input={
"sheets": [
{
"id": "screen",
"matches": true
},
{
"id": "print",
"matches": false
}
]
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonIntrinsic dimensions
The natural pixel width and height of the decoded image.
The natural pixel width and height of the decoded image. An image format is a representation trade-off, not an automatic guarantee of fewer bytes or equal quality. Compare actual encoded size, dimensions and visual fidelity for the intended use. This calculation compares supplied file-byte records; the image studio loads the actual local PNG fixtures and measures bytes and decode intervals.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {savedBytes:input.before-input.after,smaller:input.after<input.before};
}
const input={
"before": 2400000,
"after": 180000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonEncoded size
The bytes in a representation, distinct from image dimensions and displayed size.
The bytes in a representation, distinct from image dimensions and displayed size. An image format is a representation trade-off, not an automatic guarantee of fewer bytes or equal quality. Compare actual encoded size, dimensions and visual fidelity for the intended use. This calculation compares supplied file-byte records; the image studio loads the actual local PNG fixtures and measures bytes and decode intervals.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {savedBytes:input.before-input.after,smaller:input.after<input.before};
}
const input={
"before": 2400000,
"after": 180000
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonMicrotask
A queued callback such as a promise reaction processed at defined checkpoints before subsequent tasks.
A queued callback such as a promise reaction processed at defined checkpoints before subsequent tasks. Script discovery, download and execution are different stages. A blocking classic script can pause parsing, while defer and async alter scheduling. This conceptual sequence explains the dependency; it is not a measured network or main-thread trace. Verify actual behavior using controlled scripts or the browser developer tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.lifecycle({script:input.mode,cssBlocking:false}).events.find(e=>e.includes("script"));
}
const input={
"mode": "blocking"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonTask
A unit of scheduled main-thread work. Long work can delay other opportunities.
A unit of scheduled main-thread work. Long work can delay other opportunities. Script discovery, download and execution are different stages. A blocking classic script can pause parsing, while defer and async alter scheduling. This conceptual sequence explains the dependency; it is not a measured network or main-thread trace. Verify actual behavior using controlled scripts or the browser developer tools.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.lifecycle({script:input.mode,cssBlocking:false}).events.find(e=>e.includes("script"));
}
const input={
"mode": "blocking"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonLayout
The computation of element geometry; a rectangle does not expose separate paint timing.
The computation of element geometry; a rectangle does not expose separate paint timing. HTML parsing converts source markup into a DOM, and browser error recovery can make that DOM differ from the text you wrote. Inspect the constructed elements rather than assuming source nesting was preserved. This example uses the actual DOM parser in the isolated browser preview; it does not measure internal parser duration.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
const template=document.createElement("template");template.innerHTML=input.html;return template.content.querySelectorAll("p").length;
}
const input={
"html": "<p>One</p><p>Two</p>"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonStatus code
A response classification; a successful exchange does not prove application correctness.
A response classification; a successful exchange does not prove application correctness. An HTTP request has a method, target and headers, with a body when the protocol permits one. Request construction is different from sending it. Here a plain object makes the contract visible without bypassing browser origin controls or inventing a server response. The HTTP lab separately performs permitted same-origin requests.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {method:input.method,path:input.path,headers:{Accept:input.accept}};
}
const input={
"method": "GET",
"path": "/sample.json",
"accept": "application/json"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonHTTP
The request/response protocol used to transfer web representations.
The request/response protocol used to transfer web representations. An HTTP request has a method, target and headers, with a body when the protocol permits one. Request construction is different from sending it. Here a plain object makes the contract visible without bypassing browser origin controls or inventing a server response. The HTTP lab separately performs permitted same-origin requests.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return {method:input.method,path:input.path,headers:{Accept:input.accept}};
}
const input={
"method": "GET",
"path": "/sample.json",
"accept": "application/json"
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonNavigation
Loading a document through a sequence that can include redirects, requests, parsing and presentation.
Loading a document through a sequence that can include redirects, requests, parsing and presentation. A browser retrieves documents, constructs a document model, resolves style and schedules work before pixels can be displayed. These responsibilities overlap rather than forming one perfectly serial pipeline. This conceptual sequence separates responsibilities so you can ask which evidence supports a diagnosis. It is not an internal browser process trace.
// Controlled lesson program. Read evidence labels; no remote site is inspected.
const E=require("./engine.js");
function feature(input){
return E.lifecycle({script:input.script,cssBlocking:input.css}).events.length;
}
const input={
"script": "defer",
"css": true
};
Promise.resolve().then(()=>feature(input)).then(value=>{
console.log(JSON.stringify(value));
}).catch(error=>console.log("ERROR: "+error.message));
Open related lessonProgramming
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");Open related lessonProgram
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);Open related lesson
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;Open related lesson
Instruction
An operation described by source code.
An operation described by source code. The example shows its use in JavaScript source.
console.log("Run");Open related lessonStatement
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;Open related lesson
Expression
Source that evaluates to a value.
Source that evaluates to a value. The example shows its use in JavaScript source.
5 * 3Open related lesson
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.
42Open related lesson
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");Open related lessonComment
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.Open related lesson
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.
itemsInCartOpen related lesson
Keyword
A word reserved for a language construct.
A word reserved for a language construct. The example shows its use in JavaScript source.
constOpen related lesson
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;Open related lesson
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) * 3Open related lesson
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"); }Open related lessonBracket
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]Open related lesson
Literal
Source syntax directly representing a value.
Source syntax directly representing a value. The example shows its use in JavaScript source.
"Hello"Open related lesson
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");Open related lessonOutput
An observable result produced by execution.
An observable result produced by execution. The example shows its use in JavaScript source.
console.log(15);Open related lesson
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")Open related lessonAlgorithm
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.Open related lesson
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;Open related lesson
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";Open related lesson
Declaration
Syntax that introduces a binding.
Syntax that introduces a binding. The example shows its use in JavaScript source.
let count;Open related lesson
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;Open related lesson
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;Open related lesson
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;Open related lesson
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;Open related lesson
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;Open related lesson
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 5Open related lesson
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"Open related lesson
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.5Open related lesson
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.
trueOpen related lesson
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;Open related lesson
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;Open related lesson
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")Open related lessonInfinity
A numeric value beyond finite magnitude.
A numeric value beyond finite magnitude. The example shows its use in JavaScript source.
1 / 0Open related lesson
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.
123nOpen related lesson
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")Open related lessonPrimitive
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"Open related lesson
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")Open related lessonCoercion
Conversion performed implicitly by a language operation.
Conversion performed implicitly by a language operation. The example shows its use in JavaScript source.
"5" + 2Open related lesson
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")Open related lessonFalsy
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("")Open related lessonImmutability
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()Open related lesson
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");Open related lessonState
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;Open related lesson
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;Open related lesson
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};Open related lessonDeep 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)Open related lesson
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)Open related lesson
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 >= 5Open related lesson
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(); }Open related lessonLoop
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++) {}Open related lessonIteration
One pass through a loop body.
One pass through a loop body. The example shows its use in JavaScript source.
console.log(i);Open related lesson
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;Open related lesson
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++Open related lesson
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) {}Open related lessonFunction
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; }Open related lessonParameter
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) {}Open related lessonArgument
A value supplied in a call.
A value supplied in a call. The example shows its use in JavaScript source.
greet("Alex")Open related lessonReturn 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;Open related lesson
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)Open related lesson
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 * 2Open related lesson
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; }Open related lessonBlock 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; }Open related lessonGlobal scope
The outer scope for a script environment.
The outer scope for a script environment. The example shows its use in JavaScript source.
globalThisOpen related lesson
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; }Open related lessonClosure
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; }Open related lessonCall 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()Open related lesson
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)Open related lesson
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)Open related lesson
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;Open related lesson
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 * 2Open related lesson
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";Open related lesson
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 positionOpen related lesson
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;Open related lesson
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;Open related lessonSpread 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]Open related lesson
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) {}Open related lessonDefault 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") {}Open related lessonArray
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"]Open related lesson
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]Open related lesson
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]Open related lesson
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.lengthOpen related lesson
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"}Open related lessonProperty
A key-value association on an object.
A key-value association on an object. The example shows its use in JavaScript source.
person.nameOpen related lesson
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"Open related lesson
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()Open related lesson
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)Open related lesson
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 {}Open related lessonInstance
An object created with a particular constructor.
An object created with a particular constructor. The example shows its use in JavaScript source.
new Counter()Open related lesson
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; }Open related lesson