ECMA-262 defines a standard library of objects, all reachable from the global object
(The Global Object). Each host adds more of its own, such as console,
setTimeout, fetch and document; those are not part
of the language. Draft below means the current draft, expected in ES2027.
Global values and functions
| Name | Kind | Added |
|---|---|---|
globalThis | The global object | ES2020 |
Infinity, NaN, undefined | Read-only values | Early editions |
eval | Run source text | ES1 |
parseInt, parseFloat | Parse the start of a string as a number | ES1 |
isNaN, isFinite | Test a number after ToNumber | ES1 |
encodeURI, encodeURIComponent, decodeURI, decodeURIComponent | URI encoding | ES3 |
escape, unescape | Legacy encoding, in Annex B | ES1 |
Constructors and namespaces
| Object | What it is | Added |
|---|---|---|
Object | Base of the object system | ES1 |
Function | Functions | ES1 |
Boolean, Number, String | Wrappers for the primitives | ES1 |
Array | Lists | ES1 |
Date | Time values as milliseconds since the epoch | ES1 |
Math | Numeric functions and constants (namespace) | ES1 |
RegExp | Regular expressions | ES3 |
Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError | Errors | ES3 |
JSON | Parse and stringify (namespace) | ES5 |
Symbol | Unique keys | ES2015 |
Map, Set, WeakMap, WeakSet | Keyed collections | ES2015 |
Promise | Asynchronous results | ES2015 |
Proxy | Intercepts operations on an object | ES2015 |
Reflect | Internal methods as functions (namespace) | ES2015 |
ArrayBuffer, DataView | Raw bytes and access to them | ES2015 |
Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array | Typed arrays | ES2015 |
SharedArrayBuffer | Memory shared between agents | ES2017 |
Atomics | Atomic operations (namespace) | ES2017 |
BigInt | Arbitrary-size integers | ES2020 |
BigInt64Array, BigUint64Array | Typed arrays of 64-bit integers | ES2020 |
AggregateError | Holds several errors | ES2021 |
WeakRef, FinalizationRegistry | Weak references and clean-up callbacks | ES2021 |
Iterator | Iterators and helpers | ES2025 |
Float16Array | Typed array of 16-bit floats | ES2025 |
SuppressedError | Error raised during disposal | Draft |
DisposableStack, AsyncDisposableStack | Manual groups of resources to dispose | Draft |
Other standard objects have no global name and exist only as intrinsics, for example
%TypedArray%, %GeneratorFunction% and
%AsyncFunction%. Intl is defined by a separate standard,
ECMA-402. Temporal has reached stage 4 of the TC39 process and is
expected in ES2027, but was not in the text of the draft at the time of writing.
Later additions by object
| Object | Addition | Added |
|---|---|---|
Object | keys, create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, freeze, seal, preventExtensions, isFrozen, isSealed, isExtensible | ES5 |
Object | assign, is, setPrototypeOf, getOwnPropertySymbols | ES2015 |
Object | values, entries, getOwnPropertyDescriptors | ES2017 |
Object | fromEntries | ES2019 |
Object | hasOwn | ES2022 |
Object | groupBy | ES2024 |
Function | Function.prototype.bind | ES5 |
Array | isArray, indexOf, lastIndexOf, every, some, forEach, map, filter, reduce, reduceRight | ES5 |
Array | from, of, find, findIndex, fill, copyWithin, keys, values, entries | ES2015 |
Array | includes | ES2016 |
Array | flat, flatMap; sort is required to be stable | ES2019 |
Array | at | ES2022 |
Array | findLast, findLastIndex, toReversed, toSorted, toSpliced, with | ES2023 |
Array | Array.fromAsync | ES2026 |
String | trim | ES5 |
String | startsWith, endsWith, includes, repeat, codePointAt, normalize, fromCodePoint, raw | ES2015 |
String | padStart, padEnd | ES2017 |
String | trimStart, trimEnd | ES2019 |
String | matchAll | ES2020 |
String | replaceAll | ES2021 |
String | at | ES2022 |
String | isWellFormed, toWellFormed | ES2024 |
Number | isInteger, isSafeInteger, isFinite, isNaN, parseFloat, parseInt, EPSILON, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER | ES2015 |
Math | trunc, sign, cbrt, log2, log10, log1p, expm1, sinh, cosh, tanh, asinh, acosh, atanh, hypot, imul, clz32, fround | ES2015 |
Math | f16round | ES2025 |
Math | sumPrecise | ES2026 |
Date | now, toISOString, toJSON | ES5 |
Map | Map.groupBy | ES2024 |
Map, WeakMap | getOrInsert, getOrInsertComputed | ES2026 |
Set | union, intersection, difference, symmetricDifference, isSubsetOf, isSupersetOf, isDisjointFrom | ES2025 |
Symbol | description | ES2019 |
Symbol | Most symbols allowed as keys in weak collections | ES2023 |
Promise | Listed under Async | ES2015 onwards |
RegExp | flags, the u and y flags, and the Symbol.match family | ES2015 |
RegExp | RegExp.escape, modifiers, duplicate named groups | ES2025 |
JSON | JSON.stringify gives well-formed output | ES2019 |
JSON | rawJSON, isRawJSON; a context argument to parse revivers | ES2026 |
ArrayBuffer | resize, maxByteLength, transfer, transferToFixedLength | ES2024 |
Uint8Array | fromBase64, setFromBase64, toBase64, fromHex, setFromHex, toHex | ES2026 |
Atomics | waitAsync | ES2024 |
Atomics | pause | Draft |
Error | The cause option | ES2022 |
Error | Error.isError | ES2026 |
Errors
| Type | Raised when | Added |
|---|---|---|
Error | Base type | ES3 |
TypeError | A value is the wrong type; property of undefined; calling a non-function | ES3 |
ReferenceError | An unresolvable name, or the temporal dead zone | ES3 |
SyntaxError | Invalid syntax, and an invalid eval or new Function | ES3 |
RangeError | A value outside its range, such as an array length | ES3 |
URIError | Malformed input to the URI functions | ES3 |
EvalError | Kept for compatibility; not raised by the standard now | ES3 |
AggregateError | Several errors at once, in errors | ES2021 |
SuppressedError | An error raised during disposal, with error and suppressed | Draft |
An error has message and name, and may have
cause: new Error('failed', { cause: e }). The
stack property is provided by engines and is not in ECMA-262.
Annex B
Annex B lists legacy features required in web browsers and optional elsewhere.
| Object | Members |
|---|---|
| Global | escape, unescape |
String.prototype | substr, trimLeft, trimRight, and the HTML methods anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link, small, strike, sub, sup |
Date.prototype | getYear, setYear, toGMTString |
RegExp.prototype | compile |
Annex B also covers HTML-like comments, legacy numeric forms, block-level function semantics and the legacy parts of regular expressions, described on their own pages.