Bookmarks
ReferenceFrontendBackendVerified

JavaScript

JavaScript (JS, ECMAScript) is a programming language for the browser and the server. In this reference: types, functions, classes, modules, promises, the DOM, events and fetch.

checked 1 Nov · next check 8 Nov · 52 min read

Sections
13
Reading
52 min
Languages
RU · UZ · EN
Written from
developer.mozilla.org/en-US/docs/Web/JavaScript

Check status of the reference

Verified 1 Nov · next check 8 Nov

The sections were compared with the release notes, the check found nothing, and all source links respond.

  1. Verified
  2. Scheduled check

What JavaScript is and how it works

JavaScript is a programming language standardised as ECMAScript: it is used to make pages interactive in the browser and to write servers in Node.js. The language is the same everywhere; the environment the code runs in provides access to the page, the network and files.

JavaScript is essential whenever a page has to respond to user actions: showing a menu, validating a form, loading data without a reload. A modern browser is enough to run such code. Outside the browser, the same language runs in Node.js — on servers and in development tools. Code runs on a single thread, so a long computation on a page freezes the interface: such tasks are moved to a Web Worker. JavaScript does not check that a variable is only ever assigned values of one type: if you need that check before the code runs, you use TypeScript.

Running JavaScript is a joint effort of two programs. The engine parses the source code and executes it: it maintains the call stack and the heap, where objects live. These are V8 in Chrome and Node.js, SpiderMonkey in Firefox, JavaScriptCore in Safari. The host environment — the browser or Node.js — connects the code to the outside world. The browser provides the DOM, timers and fetch(); Node.js provides file and network access. When a timer fires or a response arrives, the callback goes into the task queue, and the event loop hands it to the engine as soon as the call stack is empty.

In Node.js the design is the same; only the set of host APIs changes: no DOM, but files and networking instead.

Where to run code

To try things out, the browser console in DevTools works well: it runs the code you enter and immediately shows the result of the last expression. On a page, a script is attached with a <script> element; the type="module" attribute makes the file an ES module — ES modules are covered in the “ES modules” section. Outside the browser, the file is run with the node command.

htmlindex.html
<script type="module" src="app.js"></script>
bashterminal
node app.js

How JavaScript differs from TypeScript, Node.js and Java

NameWhat it isHow it relates to JavaScript
ECMAScriptthe language standard (ECMA-262)JavaScript implements ECMAScript; the names are often used as synonyms
TypeScripta typed superset of the languageworking JavaScript code is already valid TypeScript code; type errors show up before the code runs
Node.jsa runtimeruns JavaScript outside the browser on the V8 engine; files and networking instead of the DOM
Javaa different languagesimilar in expression syntax, but built on classes and static typing

Choose TypeScript if you want the editor to catch type errors before the code runs; choose Node.js when you need JavaScript on the server, in scripts and in tools.

What to know beforehand

  • HTML: elements, attributes and how they nest — the “HTML and CSS” reference
  • Programming basics in any language: variables, conditionals, loops

Section sources

the section is written from these pages

Cheat sheet

Common JavaScript constructs by task: variables and conditionals, loops, strings, arrays, objects, functions, asynchronous code, the DOM and events. Each row is explained in its own section of the reference.

Variables and conditionals

TaskHow to write it
A constantconst limit = 10;
A variable that will be changedlet count = 0;
Compare without type coerciona === b, a !== b
A value in place of null and undefinedconst name = input ?? "guest";
Read a property that may be missinguser?.address?.city
Pick one of two valuesconst sign = n >= 0 ? "+" : "-";
Assign only if there is no value yetoptions.timeout ??= 5000;

Loops and errors

TaskHow to write it
Iterate over array elementsfor (const item of items) { … }
Iterate over the keys and values of an objectfor (const [key, value] of Object.entries(obj)) { … }
A loop with a counterfor (let i = 0; i < 3; i++) { … }
Skip to the next step, exit the loopcontinue;, break;
Throw an errorthrow new Error("No data");
Catch an errortry { … } catch (error) { … } finally { … }

Strings

TaskHow to write it
Interpolate values into a stringa template literal in backticks with ${total} inside
Length of a stringtext.length
Whether a substring is present, start of a stringtext.includes("js"), url.startsWith("https:")
Trim whitespace at the edgestext.trim()
Split a string and join an arrayline.split(","), parts.join(", ")
String to numberNumber("42"), parseInt("42px", 10)

Arrays

TaskHow to write it
Append at the end, take the last oneitems.push(x), items.at(-1)
Transform each elementitems.map((x) => x * 2)
Filter by a conditionitems.filter((x) => x > 0)
Find the first matchusers.find((u) => u.id === 7)
Reduce to a single valueitems.reduce((sum, x) => sum + x, 0)
A sorted copy of numbersnums.toSorted((a, b) => a - b)
Remove duplicates[...new Set(items)]

Objects and JSON

TaskHow to write it
Pull fields into variablesconst { name, age } = user;
A copy with a changed field{ ...user, age: 31 }
Keys, key–value pairsObject.keys(user), Object.entries(user)
Whether an own property existsObject.hasOwn(user, "email")
To JSON and backJSON.stringify(user), JSON.parse(text)
A deep copystructuredClone(user)

Functions and classes

TaskHow to write it
An arrow functionconst square = (x) => x * x;
A default parameter and the rest of the argumentsfunction log(level = "info", ...parts) { … }
Pin this to a functionconst onTick = timer.tick.bind(timer);
A class with a private fieldclass Account { #balance = 0; }
Inheritanceclass Admin extends User { … }

Asynchronous code

TaskHow to write it
Await a resultconst data = await loadData();
Catch an errortry { await loadData(); } catch (error) { … }
Run in parallelawait Promise.all([loadUser(), loadOrders()])
Await all of them, even with errorsawait Promise.allSettled(tasks)
A request timeoutfetch(url, { signal: AbortSignal.timeout(5000) })
Wait without blocking the pageawait new Promise((r) => setTimeout(r, 1000));

DOM and events

TaskHow to write it
Find an element, find all of themdocument.querySelector(".card"), document.querySelectorAll("li")
Replace the textel.textContent = "Done";
Add, remove, toggle a classel.classList.add("active"), remove(…), toggle(…)
Create and insert an elementlist.append(document.createElement("li"))
Subscribe to an eventbutton.addEventListener("click", onClick)
Cancel the default actionevent.preventDefault()
Find the list item when delegatingconst li = event.target.closest("li");

Section sources

the section is written from these pages

Syntax and control flow

A JavaScript program is a sequence of statements separated by semicolons. Variables are declared with const and let, branching is written with if and switch, loops with for and while, and errors are caught with a try/catch block.

Variables: const, let and var

const declares a variable that cannot be reassigned; the value is set straight away. let allows reassignment. Both are visible only inside the block — the pair of curly braces they are declared in. const only forbids a new assignment: properties of an object and elements of an array held in such a variable can still be changed. Declare with const everything that is not reassigned, and use let for counters and accumulators.

javascriptvariables.js
const user = { name: "Ali" };user.name = "Vali";let count = 0;count += 1;console.log(count, user.name);
textexample output
1 Vali

The older declaration var is visible throughout the whole function rather than the block, and it is hoisted: you can access the variable before the line with the declaration and get undefined. Accessing let and const before the declaration gives a ReferenceError: from the start of the block until the declaration the variable sits in the temporal dead zone.

javascripthoisting.js
// var is hoisted: x already exists here and equals undefinedconsole.log(x);var x = 3; // let and const before the declaration — ReferenceErrorconsole.log(y);let y = 3;

Comparison and value selection operators

=== compares without type coercion: 3 === "3" is false. == coerces the types first, so 3 == "3" is true; compare with === and !==. The operators &&, || and ?? return one of their operands, not necessarily true or false. ?? takes the right-hand side only when the left-hand side is null or undefined, while || does so for any falsy value, including 0 and the empty string.

Optional chaining ?. returns undefined instead of an error when the object on the left is null or undefined. Logical assignment a ??= b writes b only when a holds null or undefined, and a ||= b when it holds any falsy value.

javascriptoperators.js
const settings = { retries: 0, title: "" };console.log(settings.retries || 3, settings.retries ?? 3);console.log(settings.theme?.color);settings.title ||= "Untitled";settings.timeout ??= 5000;console.log(settings.title, settings.timeout);
textexample output
3 0undefinedUntitled 5000

Conditionals

In an if, the condition is converted to a boolean. Falsy values are false, 0 and 0n, the empty string "", null, undefined and NaN; everything else, including any object and an empty array, is truthy. In a switch, the value is compared against case labels with ===; without break, execution continues into the next branch. To choose between two values there is the ternary operator condition ? a : b.

javascriptprice.js
function price(drink) {  switch (drink) {    case "tea":      return 5000;    case "coffee":    case "cocoa":      return 12000;    default:      return null;  }}const total = price("cocoa") ?? 0;console.log(total > 10000 ? "expensive" : "affordable", total);
textexample output
expensive 12000

Loops

for...of iterates over the values of an array, a string, a Map, a Set and other iterables. for...in iterates over the property names of an object, including properties added to an array by hand, so it is not suitable for arrays. The classic for with a counter is needed when the index matters. continue moves on to the next step, break stops the loop.

javascriptloops.js
const scores = [7, 0, 9];for (const score of scores) {  if (score === 0) continue;  console.log(score);}const user = { name: "Ali", city: "Tashkent" };for (const [key, value] of Object.entries(user)) {  console.log(`${key}: ${value}`);}
textexample output
79name: Alicity: Tashkent

Destructuring and template literals

Destructuring unpacks an array or an object into variables in a single line. A default value applies only when the property is missing or holds undefined, but not null. ...rest gathers the remaining elements into a new array or object. A template literal in backticks substitutes expressions into ${…} and can span several lines.

javascriptdestructuring.js
const [first, second, ...rest] = [10, 20, 30, 40];const user = { name: "Ali", role: undefined, city: null };const { name, role = "guest", city = "?" } = user;const { name: login } = user;console.log(first, second, rest.length, role, city, login);console.log(`User ${name}, role: ${role}`);
textexample output
10 20 2 guest null AliUser Ali, role: guest

Exceptions: throw, try, catch, finally

throw throws an exception — a value of any type, but it is better to throw an Error object or one of its subclasses: they have the name and message properties. If an exception occurs inside try, control immediately passes to catch. The finally block always runs, whether or not there was an error. A return inside finally replaces both the result and the thrown exception, which is why it is not written there.

javascripterrors.js
function parseAge(text) {  const age = Number(text);  if (Number.isNaN(age) || age < 0) {    throw new RangeError(`Invalid age: ${text}`);  }  return age;} try {  parseAge("-5");} catch (error) {  console.error(error.name, error.message);} finally {  console.log("check finished");}
textexample output
RangeError Invalid age: -5check finished

Semicolons

After a statement that sits on its own line the semicolon can be omitted: the language inserts it itself, following the rules of automatic semicolon insertion (ASI). Still, put it after every statement — fewer mistakes make it into the code that way. The ASI trap with return and a line break is covered in the section “Functions, scope and closures”.

Section sources

the section is written from these pages

Types and data structures

JavaScript has eight types of values: seven primitives — undefined, null, boolean, number, bigint, string and symbol — and the object. A type belongs to a value, not to a variable: the same variable can be assigned a number and then a string, and in mixed operations the language coerces the types on its own.

TypeWhat typeof returnsExample
Undefined"undefined"undefined
Null"object"null
Boolean"boolean"true, false
Number"number"42, 3.14, NaN, Infinity
BigInt"bigint"9007199254740993n
String"string""text"
Symbol"symbol"Symbol("id")
Object"object", and "function" for functions{}, [], new Map(), () => {}

Primitives are immutable: a string’s methods return a new string and the original stays the same. Objects are the only mutable values; functions are objects too, ones that can be called. typeof null returns "object", so null is checked with the comparison value === null.

Numbers: Number and BigInt

Number is a 64-bit IEEE 754 floating-point number. Integers in it are exact only up to Number.MAX_SAFE_INTEGER, that is 2 ** 53 - 1. Decimal fractions are stored approximately, which is why 0.1 + 0.2 does not equal 0.3. NaN is the only value that is not equal to itself: check for it with Number.isNaN(). BigInt stores integers of any length, and its literal is written with the n suffix. Mixing BigInt and Number in arithmetic is not allowed — you get a TypeError; convert explicitly with Number() or BigInt().

javascriptnumbers.js
console.log(0.1 + 0.2, 0.1 + 0.2 === 0.3);const max = Number.MAX_SAFE_INTEGER;console.log(max + 1 === max + 2);console.log(2n ** 64n);console.log(NaN === NaN, Number.isNaN(NaN));
textexample output
0.30000000000000004 falsetrue18446744073709551616nfalse true

Strings

A string is a sequence of UTF-16 code units; length counts them, not the visible characters, so "😀".length equals 2. A string cannot be changed in place: every method returns a new one.

MethodWhat it returns
s.includes("js"), s.startsWith("http")true if the substring is present or the string starts with it
s.slice(0, 3), s.at(-1)part of the string; the character from the end by a negative index
s.trim()the string without whitespace at the edges
s.split(",")an array of the parts between separators
s.replaceAll("-", " ")the string with all occurrences replaced
s.toUpperCase(), s.toLowerCase()the string in upper or lower case
s.padStart(2, "0")the string padded on the left to the required length: "7" → "07"

Type coercion

JavaScript is a weakly typed language: in an operation with different types it coerces them rather than throwing an error. + with a string concatenates, the other arithmetic operators turn their operands into numbers. An object is first converted to a primitive: {} becomes the string "[object Object]", [] an empty string. Instead of guessing, coerce explicitly: Number(), String(), Boolean(), parseInt(text, 10).

javascriptcoercion.js
console.log("37" + 7, "37" - 7);console.log(Number("42px"), parseInt("42px", 10));console.log("3" == 3, "3" === 3);console.log({} + []);
textexample output
377 30NaN 42true false[object Object]

Comparison: ===, == and Object.is

  • === compares without type coercion; the special cases are NaN !== NaN and +0 === -0.
  • == coerces types by intricate rules; null == undefined is true. In most cases it is not used: the result of === is easier to predict.
  • Object.is() works like ===, but treats NaN as equal to NaN and +0 and -0 as different.
  • includes() finds NaN in an array while indexOf() does not: it compares through ===.
  • Objects are compared by reference: two different objects with identical fields are not equal. There is no built-in deep comparison.
javascriptequality.js
const a = { id: 1 };const b = { id: 1 };console.log(a === b, a === a);console.log(null == undefined, null === undefined);console.log(Object.is(NaN, NaN), Object.is(0, -0));console.log([NaN].includes(NaN), [NaN].indexOf(NaN));
textexample output
false truetrue falsetrue falsetrue -1

Value and reference: copying objects

A variable with an object holds a reference to it: assignment copies the reference, not the object. The spread syntax { ...obj } and [...arr], Array.from() and slice() make a shallow copy: nested objects stay shared. A deep copy is made by structuredClone().

javascriptcopies.js
const order = { id: 7, items: ["tea"] };const alias = order;const shallow = { ...order };const deep = structuredClone(order);order.items.push("bread");console.log(alias === order);console.log(shallow.items.length, deep.items.length);
textexample output
true2 1

Arrays: mutating and copying methods

Some methods change the array itself, others return a new one. If the original array is still needed, take the copying counterpart from the table. Sort numbers with a compare function: without it [10, 9, 1].toSorted() gives [1, 10, 9].

Mutates the arrayReturns a new array
sort()toSorted()
reverse()toReversed()
splice(1, 2)toSpliced(1, 2)
arr[0] = xarr.with(0, x)
push(x)concat([x])
pop(), shift()slice(0, -1), slice(1)
javascriptsorting.js
const nums = [10, 9, 1];console.log(nums.toSorted().join(", "));console.log(nums.toSorted((a, b) => a - b).join(", "));console.log(nums.join(", "));
textexample output
1, 10, 91, 9, 1010, 9, 1

Map, Set and the object as a dictionary

Map stores key–value pairs with keys of any type, knows its own size and is iterated in insertion order. In an object the keys are only strings and symbols, and the prototype adds properties of its own. Take Map when the keys become known only while the program runs, especially when they come from outside; an object — when the set of fields is known in advance. Set stores unique values.

javascriptcollections.js
const visits = new Map();for (const page of ["/", "/news", "/"]) {  visits.set(page, (visits.get(page) ?? 0) + 1);}console.log(visits.get("/"), visits.size);const tags = new Set(["js", "css", "js"]);console.log([...tags].join(", "), tags.has("css"));
textexample output
2 2js, css true

JSON

JSON is a text format for exchanging data that many programming languages understand. JSON.stringify() turns a value into a JSON string, JSON.parse() — back.

javascriptjson.js
const text = JSON.stringify({ id: 7, tags: ["js"] });console.log(text);console.log(JSON.parse(text).tags[0]);
textexample output
{"id":7,"tags":["js"]}js

Section sources

the section is written from these pages

Functions, scope and closures

A function is an object that can be called: it takes arguments and returns a value through return, and without it — undefined. A function can be declared in three ways: a function declaration, a function expression and an arrow function. They differ in hoisting and in where this comes from.

javascriptfunctions.js
function square(x) {  return x * x;}const cube = function (x) {  return x ** 3;};const half = (x) => x / 2;console.log(square(4), cube(2), half(9));
textexample output
16 8 4.5
Featurefunction declarationArrow function =>
Calling before declarationworks: the declaration is hoisted in fullno: before the const line the variable is unavailable
Own thisyes, it depends on how the function is calledno: takes this from outside
arguments objectyesno, use ...args
Calling with newpossibleTypeError: not a constructor

The function expression const f = function () {} behaves like a declaration, only it is not hoisted. An arrow function with an expression body returns that value without return; an object literal is wrapped in parentheses in that case: () => ({ ok: true }).

Default and rest parameters

A parameter with no argument equals undefined; the default value is set right in the function signature. The rest parameter ...args gathers the extra arguments into a real array. Arguments are passed by value, but the value of an object is a reference: if the function changes the properties of the object it received, the change is visible outside.

javascriptparams.js
function greet(name = "guest", ...tags) {  const list = tags.length > 0 ? tags.join(", ") : "none";  return `Hello, ${name}! Tags: ${list}`;}console.log(greet());console.log(greet("Ali", "admin", "beta"));
textexample output
Hello, guest! Tags: noneHello, Ali! Tags: admin, beta

Scope

Scope determines where a variable is accessible. There are four kinds: global, module, function and block — the last one only for let and const. An inner function sees the variables of all enclosing scopes, while an outer one does not see the inner function’s variables. When names clash, the nearest scope wins: this is how the scope chain is built.

Closures

A closure is a function together with the variables of the place where it was created. The function remembers those variables even after the outer function has finished. This is how private state is built: the variable can only be reached through the returned function.

javascriptcounter.js
function makeCounter() {  let count = 0;  return () => {    count += 1;    return count;  };}const next = makeCounter();next();console.log(next());
textexample output
2

The classic mistake is closures in a loop with var. With var there is one variable for the whole function, and every function created in the loop sees its last value. let in the for header creates a new variable at each step.

javascriptloop-closures.js
const withVar = [];for (var i = 0; i < 3; i++) {  withVar.push(() => i);}const withLet = [];for (let j = 0; j < 3; j++) {  withLet.push(() => j);}const show = (fns) => fns.map((f) => f()).join();console.log(show(withVar), show(withLet));
textexample output
3,3,3 0,1,2

this depends on how the function is called

this in an ordinary function is a hidden parameter set at call time, not at declaration. The same function called on different objects will get a different this.

How the function is calledWhat this equals
obj.method()obj — the object before the dot
fn()undefined in strict mode, globalThis outside it
new Fn()the newly created object
fn.call(ctx, a), fn.apply(ctx, [a]), fn.bind(ctx)ctx
arrow functionthe this of the place where it was created; call and bind do not change it
javascriptthis.js
"use strict";const timer = {  seconds: 0,  tick() {    this.seconds += 1;    return this.seconds;  },};console.log(timer.tick());const tick = timer.tick;// tick() will throw a TypeError: this here is undefinedconst bound = timer.tick.bind(timer);console.log(bound());
textexample output
12

Higher-order functions

Functions are ordinary values: they are passed as arguments (callbacks) and returned from other functions. Array methods are built on this: map() transforms each element, filter() keeps the matching ones, find() returns the first match, and reduce() folds the array into a single value.

javascriptprices.js
const prices = [12000, 8000, 30000];const total = prices  .filter((price) => price >= 10000)  .map((price) => price * 0.9)  .reduce((sum, price) => sum + price, 0);console.log(total);
textexample output
37800

Section sources

the section is written from these pages

Objects, prototypes and classes

An object is a set of key–value properties; a property whose value is a function is called a method. Every object is linked to its prototype: a property an object does not have is looked up along the prototype chain. Classes are syntax layered on top of this mechanism.

javascriptuser.js
const key = "city";const user = {  name: "Ali",  "last-visit": "2026-10-31",  [key]: "Tashkent",  greet() {    return `Hello, ${this.name}!`;  },};console.log(user.name, user["last-visit"], user.city);console.log(user.greet(), user.email);
textexample output
Ali 2026-10-31 TashkentHello, Ali! undefined

A key is a string or a symbol; a number or an object used as a key is converted to a string. Dot notation reads properties whose names are identifiers, while names with a hyphen, a space or taken from a variable need square brackets. A missing property equals undefined. Be careful with names from external input: bracket access by such a name can make the code vulnerable to object injection attacks.

Enumerating and checking properties

Object.keys() returns the names of an object’s own enumerable properties, while the for...in loop also walks over inherited ones. Object.hasOwn(obj, key) checks only own properties, and the in operator checks inherited ones too. Properties are removed with the delete operator.

javascriptown-properties.js
const base = { role: "user" };const admin = { __proto__: base, name: "Vali" };console.log(Object.keys(admin).join(), admin.role);console.log("role" in admin, Object.hasOwn(admin, "role"));
textexample output
name usertrue false

An immutable object: Object.freeze

Object.freeze() forbids adding, removing and changing an object’s properties. In strict mode such an attempt throws a TypeError; outside it, nothing happens silently. Freezing is shallow: nested objects stay mutable and must be frozen separately.

javascriptfreeze.js
"use strict";const config = Object.freeze({  port: 8080,  db: { host: "localhost" },});try {  config.port = 80;} catch (error) {  console.log(error.name);}config.db.host = "db.example.org";console.log(config.port, config.db.host);
textexample output
TypeError8080 db.example.org

The prototype chain

Every object has an internal link, [[Prototype]], to another object or to null. A property is looked up on the object itself first, then on its prototype, on the prototype’s prototype and so on down to null. Writing a property creates an own property that shadows the same-named property on the prototype. Object literals get Object.prototype as their prototype and arrays get Array.prototype: that is why every array has map().

javascriptprototype.js
const animal = {  speak() {    return `${this.name} makes a sound`;  },};const cat = Object.create(animal);cat.name = "Mosh";console.log(cat.speak());console.log(Object.getPrototypeOf(cat) === animal);console.log(Object.getPrototypeOf(animal) === Object.prototype);
textexample output
Mosh makes a soundtruetrue

The prototype is read with Object.getPrototypeOf() and changed with Object.setPrototypeOf(). The obj.__proto__ accessor is non-standard and deprecated; the __proto__ key in an object literal is standard. Do not add your own methods to built-in prototypes such as Array.prototype: a method with the same name may appear in the language later, and code will break.

Classes

A class defines a constructor, methods, fields and static members. Methods live in the class’s prototype and are shared by all instances, while fields are created on each instance. Names with # are private: accessing one from outside the class is a syntax error. extends inherits a class, and super() calls the parent’s constructor; this cannot be used in the constructor before that call.

javascriptaccount.js
class Account {  #balance = 0;   constructor(owner) {    this.owner = owner;  }   deposit(amount) {    if (amount <= 0) {      throw new RangeError("Amount must be greater than zero");    }    this.#balance += amount;    return this;  }   get balance() {    return this.#balance;  }} class SavingsAccount extends Account {  constructor(owner, rate) {    super(owner);    this.rate = rate;  }} const account = new SavingsAccount("Ali", 0.1);account.deposit(500).deposit(250);console.log(account.owner, account.balance);console.log(account instanceof Account);
textexample output
Ali 750true
Class elementHow to write itWhere it lives
Constructorconstructor(owner) { … }runs when new is used
Methoddeposit(amount) { … }in Account.prototype, shared by instances
Fieldrate = 0;on each instance
Private field or method#balance = 0;accessible only inside the class
Getter and setterget balance() { … }read and written like a property
Static memberstatic from(data) { … }on the class itself, not on instances
Static blockstatic { … }runs once, when the class is declared

A class body always runs in strict mode. A class declaration is not hoisted: the class cannot be used before the line with class, just like a let variable.

What new does

  1. Creates an object whose prototype becomes Constructor.prototype.
  2. Calls the constructor, and this inside it points to that object. In a derived class, this only exists after super().
  3. Returns the created object unless the constructor returned another object.

Section sources

the section is written from these pages

ES modules

An ES module is a JavaScript file with its own scope: only what is marked export is visible outside, and other files pull it in with import. In the browser, a module is included with the <script type="module"> element; module code always runs in strict mode.

javascriptmath.js
export const PI = 3.14159; export function area(radius) {  return PI * radius * radius;} export default function format(value) {  return value.toFixed(2);}
javascriptmain.js
import format, { area, PI as pi } from "./math.js";import * as math from "./math.js"; console.log(format(area(2)), pi === math.PI);
textexample output
12.57 true

A module can have any number of named exports, but only one default export. Imported names are read-only live bindings: if the source module changes the value, the importing module sees the new one, but cannot assign its own. import declarations are hoisted and may appear only at the top level of a module, not inside functions or blocks.

What you needImportExport
Namedimport { area } from "./math.js";export function area() { … }
Defaultimport format from "./math.js";export default format;
Renamedimport { area as circleArea } from "./math.js";export { area as circleArea };
Everything as an objectimport * as math from "./math.js";—
Just to run the moduleimport "./polyfills.js";—
To pass along—export { area } from "./math.js";

A module in the browser

  • A module is deferred until the document has been parsed, like a script with defer; the defer attribute is not needed.
  • Module code runs in strict mode.
  • Module variables do not end up in the global scope and are not visible from the console.
  • A module runs once, even if it is included by several <script> elements.
  • Open a page with modules through a web server: from a file:// address the browser will not load them because of CORS rules.
  • The server must serve files with a JavaScript type, such as text/javascript, otherwise the browser will not run them.

Import paths

A path starting with ./ or ../ is resolved relative to the address of the current module (import.meta.url), while a path starting with / is relative to the site root. The browser does not guess the extension or index.js: write ./utils/index.js, not ./utils. A bare package name such as "lodash" only works in the browser with an import map or when the code has been processed by a bundler.

htmlindex.html
<script type="importmap">  {    "imports": {      "lodash": "/node_modules/lodash-es/lodash.js"    }  }</script><script type="module" src="main.js"></script>

Dynamic import()

import() loads a module on demand and returns a promise with the module object. It also works in classic scripts, accepts a computed path and suits code that is not needed straight away: an editor, charts, a rarely visited section.

javascriptin the browser
const button = document.querySelector("#show-chart");button.addEventListener("click", async () => {  const { renderChart } = await import("./chart.js");  renderChart(document.querySelector("#chart"));});

Top-level await and JSON modules

Inside a module, await can be written outside functions: modules that import it start running only after that promise resolves. JSON is imported with the import attribute with { type: "json" }: the browser checks that what arrived really is JSON and will not execute it as code.

javascriptsettings.js
import config from "./config.json" with { type: "json" }; const response = await fetch(config.apiUrl);export const settings = await response.json();

Besides ES modules, Node.js also has the older CommonJS system — require() and module.exports. How Node.js chooses between the two is covered in the Node.js reference, the “Modules” section.

Section sources

the section is written from these pages

Asynchrony: promises, async and the event loop

JavaScript runs code on a single thread: while a function is running, nothing can interrupt it. An asynchronous result — a timer that has fired, a network response, a click — arrives later as a task in the queue, and promises and async/await let you wait for it without blocking the page.

The event loop takes the oldest task from the task queue and runs it to completion — until the call stack is empty. Then all microtasks run: promise callbacks, continuations after await, functions from queueMicrotask(), including those added along the way. After that the browser may repaint and then moves on to the next task. That is why a promise callback fires before a setTimeout(…, 0) callback scheduled in the same task.

Tasks are queued by timers and browser events; microtasks — by promises and queueMicrotask().
  1. The event loop takes the oldest task from the queue and runs it until the call stack is empty.
  2. All microtasks run, including those added during this step.
  3. The browser repaints the page if needed.
  4. The loop moves on to the next task.

Walkthrough: which order

javascriptorder.js
console.log("1: synchronous code");setTimeout(() => console.log("4: task from setTimeout"), 0);Promise.resolve().then(() => console.log("3: microtask"));console.log("2: synchronous code");
textexample output
1: synchronous code2: synchronous code3: microtask4: task from setTimeout

First, all the synchronous code of the current task runs. The then callback goes into the microtask queue and fires as soon as the stack is empty. The setTimeout callback with a zero delay is a new task, and it waits for the next turn of the loop.

Promises

A promise (Promise) is an object standing in for a result that does not exist yet. It is in one of three states: pending, fulfilled with a value or rejected with a reason. then() returns a new promise, so the calls form a chain; catch() catches an error from any earlier step, and finally() runs either way. Return promises from then callbacks, otherwise the next step will not wait for the result.

javascriptin the browser
const wait = (ms) =>  new Promise((resolve) => setTimeout(resolve, ms)); wait(500)  .then(() => fetch("/api/user"))  .then((response) => response.json())  .then((user) => console.log(user.name))  .catch((error) => console.error("Failed:", error))  .finally(() => console.log("done"));

async and await

An async function always returns a promise. await suspends it until the promise settles and yields its value, turning rejection into an exception that is caught with the usual try/catch. The code before the first await runs synchronously. Outside an async function, await is a syntax error, except at the top level of a module.

javascriptin the browser
async function loadUser(id) {  try {    const response = await fetch(`/api/users/${id}`);    if (!response.ok) throw new Error(`HTTP ${response.status}`);    return await response.json();  } catch (error) {    console.error("Failed to load user:", error);    return null;  }}

Sequential or parallel

Two await in a row run the operations one after another: the second starts only when the first has finished. If the operations are independent, start them right away and wait for them with Promise.all().

javascriptparallel.js
const wait = (ms, value) =>  new Promise((resolve) => setTimeout(() => resolve(value), ms)); console.time("sequentially");const a = await wait(300, "a");const b = await wait(300, "b");console.timeEnd("sequentially"); console.time("parallel");const [c, d] = await Promise.all([  wait(300, "c"),  wait(300, "d"),]);console.timeEnd("parallel");console.log(a, b, c, d);
textexample output
sequentially: 602.371msparallel: 301.164msa b c d
MethodSettlesRejects
Promise.all(list)when all fulfil — with an array of valueson the first rejection
Promise.allSettled(list)when all settle — with an array of { status, value } or { status, reason }—
Promise.any(list)on the first fulfilment — with its valuewhen all reject — with AggregateError
Promise.race(list)as the first promise to settleas the first promise to settle

Long computations

While one task is running, the page does not respond to clicks or scrolling. Split long work into several tasks, and move heavy computations into a Web Worker — it has its own thread with its own stack and queue. The page is also blocked by legacy synchronous calls: alert() and synchronous XMLHttpRequest; use asynchronous APIs.

Section sources

the section is written from these pages

The DOM: finding and changing elements

The DOM (Document Object Model) is the tree of objects into which the browser turns an HTML document: the root is document, with elements and text nodes beneath it. Through the DOM a script finds elements, changes their text, attributes and classes, adds and removes nodes, and the browser shows the changes on the page.

Every node of the tree is an object with the Node interface. The Document root is available as document, beneath it is the html element with head and body. Tags become Element nodes, the text inside them becomes separate Text nodes. Attributes are not part of the tree: they are stored on the element. An element’s textContent is all the text of its descendants in a row.

Text inside an element is its child node of type Text.

How to find an element

MethodWhat it returns
document.querySelector(".card")the first matching element or null
document.querySelectorAll("li")a static NodeList of all matching elements
document.getElementById("main")the element with this id or null
el.closest("section")the nearest matching ancestor, starting with the element itself
el.matches(".active")true if the element matches the selector
document.getElementsByClassName("note")a live HTMLCollection

Methods with selectors accept CSS selectors; an invalid selector throws SyntaxError. querySelector() called on an element searches only among its descendants. The NodeList from querySelectorAll() is a snapshot taken at the moment of the call, while the HTMLCollection from getElementsBy… is live: it changes together with the document. Neither collection has map() or filter(); turn them into an array with [...list] or Array.from().

javascriptin the browser
const items = [...document.querySelectorAll("#tasks li")];console.log(items.map((li) => li.textContent).join(", "));const done = document.querySelector("#tasks li.done");console.log(done.textContent, done.closest("ul").id);
textexample output
Bread, TeaBread tasks

Tree traversal

parentElement, children, firstElementChild, lastElementChild, nextElementSibling and previousElementSibling traverse elements only. Their counterparts without Element — parentNode, childNodes, nextSibling — return any nodes, including text ones.

Changing elements

textContent replaces an element’s content with plain text. classList adds, removes and toggles classes — this is how an element’s appearance is changed, while the styles stay in CSS. Attributes are read and written with getAttribute() and setAttribute(), and id and class have the id and className properties. The style property sets inline styles; property names in it are written in camelCase: backgroundColor, not background-color.

javascriptin the browser
const card = document.querySelector(".card");card.textContent = "Order placed";card.classList.add("success");card.classList.toggle("hidden", false);card.setAttribute("data-state", "done");card.style.backgroundColor = "lightyellow";console.log(card.className, card.getAttribute("data-state"));
textexample output
card success done

Creating, inserting and removing

document.createElement() creates an element. append() and prepend() insert nodes and strings at the end or at the beginning, remove() removes an element. replaceChildren() replaces all the content, and with no arguments clears it. Inserting a node that already exists moves it rather than copying it; cloneNode(true) makes a copy along with its descendants.

javascriptin the browser
const tasks = [  { title: "Buy bread", done: true },  { title: "Phone mum", done: false },];const list = document.querySelector("#tasks"); function render() {  const items = tasks.map((task) => {    const li = document.createElement("li");    li.textContent = task.title;    li.classList.toggle("done", task.done);    return li;  });  list.replaceChildren(...items);} render();const first = list.firstElementChild;console.log(list.children.length, first.className);
textexample output
2 done

When the DOM is ready

A script only sees the elements that the browser has already parsed. A <script type="module"> module and a script with the defer attribute run after the whole document has been parsed, while a plain <script> should be placed at the end of <body>. Once the document has been parsed and such scripts have run, the DOMContentLoaded event fires. The load event also waits for images, so it is not needed for working with the DOM.

htmlindex.html
<script type="module" src="app.js"></script><script defer src="menu.js"></script>

If querySelector() returned null, the first thing to check is whether the script runs before the element appears.

Section sources

the section is written from these pages

Events

An event is the browser’s signal that something has happened: a click, a key press, a form submission. A handler is attached with addEventListener(). An event on a nested element bubbles up to its ancestors, so a single handler on a container can serve all of its descendants.

javascriptin the browser
const button = document.querySelector("#save");function onSave(event) {  console.log("Button pressed", event.currentTarget.id);}button.addEventListener("click", onSave);button.click();
textexample output
Button pressed save

addEventListener() attaches several handlers to the same event and lets you choose the phase; the same function is never added twice. The onclick property holds only one handler: a new assignment replaces the old one. Do not use attributes such as onclick="…" in the markup: they mix HTML and JavaScript. With a hundred buttons that means a hundred identical attributes, whereas a script attaches the handler to every button with a single loop.

Option in optionsWhat it doesDefault
onceremoves the handler after the first callfalse
capturecalls the handler during capture rather than bubblingfalse
passivepromises not to call preventDefault()false; true for wheel, touchstart and touchmove on window, document, <html> and <body>
signalremoves the handler once abort() is called on its AbortControllernot set

The event object

The handler receives the event object. event.target — the element the event originated on; event.currentTarget — the element the current handler is attached to. preventDefault() cancels the browser’s default action, such as submitting the form. Keyboard events have event.key — the pressed key. In an ordinary handler function this equals currentTarget; in an arrow function it does not.

javascriptin the browser
const form = document.querySelector("#signup");form.addEventListener("submit", (event) => {  const email = form.querySelector("[name=email]").value.trim();  if (!email.includes("@")) {    event.preventDefault();    form.querySelector(".error").textContent = "Enter an email";  }});

Capture, target and bubbling

An event on an element inside the tree goes through three phases. During capture it travels from window down to the target’s parent, then it fires on the target itself, and during bubbling it climbs back up to window. Handlers fire during bubbling by default, and with capture: true — during capture. Within a phase they are called in the order they were added.

Handlers with capture: true fire on the way down, the rest — on the way up.
  1. Capture: from window down to the target’s parent, handlers with capture: true fire.
  2. Target: handlers on the element itself fire.
  3. Bubbling: from the target’s parent up to window, the remaining handlers fire — if the event bubbles.

stopPropagation() stops the event: handlers on the elements further along the path will not fire, including those delegated to a container. stopImmediatePropagation() also cancels the remaining handlers on the current element. Not every event bubbles: for events created in code bubbles is false by default.

Delegation

Instead of a handler on every item of the list, attach one to their common container and find the element you need through event.target.closest(). This way the handler also works for elements added later.

javascriptin the browser
const list = document.querySelector("#tasks");list.addEventListener("click", (event) => {  const item = event.target.closest("li");  if (!item || !list.contains(item)) return;  item.classList.toggle("done");});list.querySelector("b").click();console.log(list.querySelector("li").className);
textexample output
done

Common events

EventWhen it happens
clicka click or activation of an element; nearly every element has it
dblclicka double click
keydowna key has been pressed; which one — in event.key
inputthe value of an <input> or <textarea> field has changed
submita form is submitted; preventDefault() cancels it
focus, bluran element has received or lost focus
mouseover, mouseoutthe pointer has entered an element or left it

Removing handlers

removeEventListener() removes a handler only if you pass the same function that was added: an anonymous function cannot be removed this way. Several handlers can be removed at once through a shared AbortSignal.

javascriptin the browser
const controller = new AbortController();const { signal } = controller;window.addEventListener("resize", onResize, { signal });document.addEventListener("keydown", onKeydown, { signal }); // later: remove both handlers at oncecontroller.abort();

Custom events

A custom event is created with new CustomEvent(): the data goes into detail, and to make the event bubble, set bubbles: true. dispatchEvent() dispatches the event and returns false if the event is cancellable (cancelable: true) and a handler has called preventDefault().

javascriptin the browser
const cart = document.querySelector("#cart");document.addEventListener("cart:add", (event) => {  console.log("Item added", event.detail.id);});const event = new CustomEvent("cart:add", {  detail: { id: 42 },  bubbles: true,});cart.dispatchEvent(event);
textexample output
Item added 42

Section sources

the section is written from these pages

fetch requests

fetch() sends an HTTP request and returns a promise with a Response object. The promise rejects only on a network failure or an invalid request: a 404 or 500 response is still a success for it, so check response.ok before reading the body.

javascriptin the browser
async function getProducts() {  const url = "https://example.org/api/products";  const response = await fetch(url);  if (!response.ok) {    throw new Error(`HTTP ${response.status}`);  }  return response.json();}

The fetch() promise fulfils as soon as the status and headers arrive — the body may still be loading. That is why the body-reading methods are asynchronous too. The body can be read only once: a second call to json() or text() fails, and if you need the body twice, call response.clone() first. json() rejects if the response is not JSON.

Property or methodWhat it provides
response.oktrue for status codes 200–299
response.status, response.statusTextthe response code and its text: 404, "Not Found"
response.headers.get("Content-Type")the value of a response header
await response.json()the body parsed as JSON
await response.text()the body as a string
await response.blob()the body as a Blob: an image, a file
response.clone()a copy of the response, to read the body again

Sending JSON and forms

The method, headers and body are passed as the second argument. By default the request is GET, and GET has no body. For JSON, set the Content-Type header and turn the object into a string.

javascriptin the browser
const response = await fetch("https://example.org/api/orders", {  method: "POST",  headers: { "Content-Type": "application/json" },  body: JSON.stringify({ productId: 7, quantity: 2 }),});

FormData collects form fields into name–value pairs and is sent as multipart/form-data, like a regular form. Encode GET query parameters with URLSearchParams and append them to the URL.

javascriptin the browser
const form = document.querySelector("#feedback");form.addEventListener("submit", async (event) => {  event.preventDefault();  const body = new FormData(form);  await fetch(form.action, { method: "POST", body });}); const params = new URLSearchParams({ q: "js", page: "2" });const searchUrl = `https://example.org/search?${params}`;const results = await fetch(searchUrl);

Cancellation and timeouts

To limit how long a request can take, pass a signal in the signal option. AbortSignal.timeout(5000) cancels the request after 5 seconds with a TimeoutError, while abort() on an AbortController cancels it right away with an AbortError. Tell them apart by error.name.

javascriptin the browser
const url = "https://example.org/api/report";try {  const signal = AbortSignal.timeout(5000);  const response = await fetch(url, { signal });  console.log(await response.text());} catch (error) {  if (error.name === "TimeoutError") {    console.error("The server did not respond within 5 seconds");  } else if (error.name === "AbortError") {    console.error("The request was cancelled");  } else {    console.error("Network error:", error);  }}

Cookies and cross-site requests

By default, fetch() sends cookies and other credentials only to its own origin. The credentials: "include" option adds them to requests to other origins too. The script only receives the response to such a request if the server returns the Access-Control-Allow-Credentials header. In addition, Access-Control-Allow-Origin must contain the page’s origin, not *.

Section sources

the section is written from these pages

Common errors and diagnostics

Start with the DevTools console: it shows the error message, the file and the line, and the arrow next to it expands the call stack. Then set a breakpoint on that line and inspect variable values in the Scopes panel.

How to check:

  1. Read the error type and message, then open the file and line from the message.
  2. Expand the call stack: it shows which function called the one that failed.
  3. Print the suspicious value with console.log() or console.error() just before the failing line.
  4. Set a breakpoint and step through the code, watching the Scopes panel.
  5. Check whether you actually awaited the promise: [object Promise] in the output means an await is missing.

A linter in the editor, such as ESLint, catches syntax errors and typos before you run the code. The wording of an error depends on the engine — V8 in Chrome, Edge and Node.js, SpiderMonkey in Firefox, JavaScriptCore in Safari — but the error type is the same everywhere. Headings below use the V8 wording unless stated otherwise.

TypeError: Cannot read properties of undefined (reading 'x')

Cause: a property is read on undefined or null — the data is not there yet, or it has no such field. In Firefox the same error reads TypeError: "x" is undefined, in Safari TypeError: undefined is not an object (evaluating 'obj.x').

javascriptcheck
console.log("user =", user, typeof user);
javascriptfix
const city = user?.address?.city ?? "not set";if (user !== undefined && user !== null) {  render(user);}

TypeError: "x" is not a function

Cause: something that is not a function is being called. Most often it is a typo in a method name (getElementByID instead of getElementById), an array method called on a plain object (obj.map()), or a property that has overwritten a method of the same name.

javascriptcheck
console.log(typeof document.getElementByID);
javascriptfix
const x = document.getElementById("foo");const doubled = Object.values(obj).map((n) => n * 2);

ReferenceError: height is not defined

Cause: the variable is not declared, is declared in a different scope, or its name is misspelled. Accessing a let or const before its declaration line also throws a ReferenceError, but with different wording — about access before initialisation.

javascriptcheck
console.log(typeof height);
  • Declare the variable before using it: const height = 70;.
  • Check that it is visible at that point: a variable declared inside a function or block is not accessible from outside.
  • Compare the letter case: Height and height are different names.

SyntaxError: JSON.parse: unexpected character

Cause: JSON.parse() or response.json() received a string that is not JSON — for example, an HTML error page instead of data. The heading shows the Firefox wording; Chrome and Node.js use different wording, but the type is still SyntaxError.

javascriptcheck
const response = await fetch(url);const type = response.headers.get("Content-Type");console.log(response.status, type);console.log((await response.clone().text()).slice(0, 200));
javascriptfix
const type = response.headers.get("Content-Type") ?? "";if (!response.ok || !type.includes("application/json")) {  throw new Error(`Not JSON: ${response.status} ${type}`);}const data = await response.json();

SyntaxError: Cannot use import statement outside a module

Cause: a file with import runs as a plain script rather than as a module — in the browser, the <script> tag has no type="module". Another cause is import inside a function or block. In Firefox the error reads import declarations may only appear at top level of a module.

htmlindex.html
<script type="module" src="main.js"></script>

Load a module that is only needed under a condition via import(): it works anywhere in the code. If the error appears in Node.js, Node.js does not treat the file as a module either; how Node.js picks the module system is covered in the Node.js reference, section “Modules”.

Unhandled promise rejection

Cause: the chain has no catch(), a promise created in then is not returned, or an await is missing so try/catch never sees the error. The browser reports such a promise with the unhandledrejection event — attach a handler to it to find the source.

javascriptcheck
window.addEventListener("unhandledrejection", (event) => {  console.error("Unhandled promise:", event.reason);});
  • Add a catch() at the end of every promise chain.
  • Return promises from then callbacks and put await before asynchronous calls.
  • Wait for independent promises with Promise.all() or Promise.allSettled().

Event handler does not fire

Cause: the script ran before the element appeared and querySelector() returned null; the element is created after the handler was attached; or the handler is attached to the wrong element.

javascriptcheck
console.log(document.querySelector("#save"));
  • Include the script as a module or at the end of <body>.
  • For elements added later, attach the handler to a container and use event delegation via event.target.closest().

Small pitfalls

SymptomCauseWhat to do
[object Promise] in the output instead of datathe promise was not awaitedadd await or handle the result in then()
All handlers created in a loop see the last value of ithe counter is declared with vardeclare it with let
this in a callback method is not the expected objectthe method is called without an object before the dotbind it with bind() or call it from an arrow function
A calculation returns NaNthe input is a string such as "70 inches" or undefinedcheck typeof value === "number" and !Number.isNaN(value)
JSON.parse() fails on [1, 2,] or {'a': 1}trailing commas and single quotes are not allowed in JSONremove the trailing comma and write names in double quotes
TypeError: 2 is not a function in 2(3 + 5)multiplication is written without *write 2 * (3 + 5)

Section sources

the section is written from these pages

Standards and their status

The JavaScript language is defined by the ECMA-262 standard; the current edition is the 17th, ECMAScript 2026, approved in June 2026. The DOM, events and other browser APIs are not part of it: they are covered by separate web standards, and the DOM is maintained by WHATWG.

DocumentWhat it definesStatusReplaced or extended by
ECMA-262, 17th edition (ECMAScript 2026)the language: syntax, types, built-in objectscurrent Ecma standard, June 2026replaced the 16th edition
TC39 draft of ECMA-262the next editionupdated continuouslywill become the next annual edition
ECMA-262, 16th edition (ECMAScript 2025)the languageprevious, June 2025replaced by the 17th edition
ECMA-262, 6th edition (ECMAScript 2015, ES6)modules, classes, let and const, promisesarchived, June 2015extended by annual editions
ECMA-262, editions 5 and 5.1 (ES5)strict mode, JSONarchived, December 2009 and June 2011replaced by the 2015 edition and later ones
ECMA-402the Intl internationalisation API: string comparison, number and date formatsEcma standard, approved annuallycomplements ECMA-262
DOM Standardnodes, the document tree, eventsmaintained by WHATWGreplaced the W3C version

How a feature gets into the standard

New features go through the proposal stages of the TC39 committee. A stage 4 proposal enters the draft of the specification and then the next annual edition: the Ecma General Assembly approves it in the summer. Engines usually implement a feature at stage 3 or 4.

StageWhat it means
0an idea: the committee has not taken it up yet
1the committee studies the problem, and the proposal has champions
2a solution has been chosen, and a draft of the specification exists
2.7the solution is approved, and tests are being written
3recommended for implementation in engines
4done: two compatible implementations pass the Test262 tests

What changed in ECMAScript 2026

  • Types: Map.prototype.getOrInsert(key, value) returns the value for a key, and if the key is missing, stores value first; getOrInsertComputed() computes the value with a function. WeakMap has the same methods.
  • Types: Math.sumPrecise() adds numbers without intermediate rounding: Math.sumPrecise([1e20, 0.1, -1e20]) gives 0.1, while ordinary addition gives 0.
  • Types: Uint8Array.fromBase64(), toBase64(), fromHex() and toHex() convert bytes to and from Base64 and a hexadecimal string.
  • Types: JSON.rawJSON() creates a value that JSON.stringify() outputs as is, for example a large number without loss of precision, and the reviver in JSON.parse() receives the source text of a primitive value as its third argument.
  • Types: Iterator.concat() joins several iterable objects into a single iterator.
  • Syntax: Error.isError() checks that a value is a genuine error, including one created in another window or frame.
  • Asynchronicity: Array.fromAsync() builds an array from an async iterable object, awaiting each value.

Outdated documents still cited

  • ES5 (2009) and ES5.1 (2011) are not “modern JavaScript”: another 12 editions have followed them.
  • ES6 and ECMAScript 2015 are the same 6th edition; from it on, editions are named after the year of release.
  • ES4 does not exist: the number was reserved, but the edition was never released.
  • ESNext is not an edition but a conventional name for future features; until they reach stage 4, they are proposals.

Section sources

the section is written from these pages

End of the reference

What changed

revision history · 4 entries

Every edit is saved as a revision: a snapshot of the reference, the reason and a summary of changes. The published version changes only after the same checks as at creation.

  1. Manual edit

    reason: manual edit
  2. Manual edit

    reason: manual edit
  3. Manual edit

    reason: manual edit
  4. Reference updated

Weekly check

How the reference is checked

Once a week — and right after news of a release or a vulnerability — the reference is checked in three steps.

  1. 1. Freshness

    Sections are compared with the release notes and changelogs from the official sources and with the topic’s news.

  2. 2. Errors

    Every section is read again: wrong facts, outdated APIs and flags, broken examples.

  3. 3. Links — by an HTTP request

    Every source link must respond. A broken link is a reason to recheck the section.

No findings — only the date changes. Findings — only the affected sections are rewritten, and they appear in “What changed”. A new version replaces the published one only after passing the same checks as at creation.

Statuses

Verified
no findings
Updated
sections rewritten, edits are listed
Rechecking
while the check runs, the previous version stays open
Needs review
disputed points: the verified version is shown, editors review

Last check

18 Nov · Check · updated · no findings

Found an error in the reference?

On the topic

tracks, news and other references
The whole “JavaScript” topic
13 sections
Another reference · Backend

Python

Verified 31 Oct
All references · 61