JavaScript
Baseline ReadyA practical reference for deciding whether a JavaScript feature is ready to use now.
- Widely available80features
- Newly available21features
- Limited support20features
Widely available
Widely availableArray (initial support)
Arrays are ordered lists of JavaScript values.
Array at()
The at() method of arrays and typed arrays returns the item at an index, including negative indices for getting items relative to the end of an array. Also known as the relative indexing method.
Array by copy
The toReversed(), toSorted(), toSpliced(), and with() methods of arrays and typed arrays return changed copies of arrays. They stand in contrast to methods such as sort() or reverse() that change arrays in place.
Array copyWithin()
The copyWithin() method of arrays and typed arrays shifts or copies items of an array to another index of the array without changing its length.
Array fill()
The fill() method of arrays and typed arrays sets all or some items of an array to a given a value.
Array find() and findIndex()
The find() and findIndex() methods of arrays and typed arrays search an array for the first item that satisfies a test function.
Array findLast() and findLastIndex()
The findLast() and findLastIndex() methods of arrays and typed arrays search an array in reverse order for the first item that satisfies a test function.
Array flat() and flatMap()
The flat() and flatMap() methods for arrays creates a new array such that each nested array item is concatenated into it.
Array includes()
The includes() method of arrays and typed arrays returns whether a given value appears in the array.
Array iteration methods
Array iteration methods
Array iterators
Arrays are iterable with the for … of statement and enumerable with the methods entries(), keys(), and values().
Array splice()
The array splice() method changes an array in-place. You can use it to delete items, overwrite items, or insert items, starting from an index.
Array.from()
The Array.from() and typed array .from() static methods copy items from an iterable or array-like object to make a new array.
Array.isArray()
The Array.isArray() static method checks whether a value is an array.
Array.of()
The Array.of() and typed array .of() static methods create new arrays from the values of any number of arguments.
Stable array sort
Stable array sort() function
Async functions
The async and await keywords allow you to use the asynchronous, promise-based behavior of a function without using promise chains.
Promise (initial support)
A promise represents an asynchronous operation which eventually succeeds or fails.
Promise finally()
The promise finally() method executes a function when the promise settles (resolves or rejects).
Promise.allSettled()
The Promise.allSettled() static method waits for an array of promises to settle (resolve or reject).
Promise.any()
The Promise.any() static method returns a promise that fulfills as soon as the first of an iterable of promises fulfills, with that promise's value. Otherwise, it rejects with an AggregateError when all of the promises have rejected.
JSON
The JSON API provides static methods for parsing values from and converting values to JavaScript Object Notation (JSON), a serialization format for objects, arrays, numbers, strings, Boolean values, and null.
Intl.DisplayNames
The Intl.DisplayNames API provides localized names of language, region, script, and currency codes.
Intl.ListFormat
The Intl.ListFormat API creates a locale-aware formatter that turns iterable objects into localized strings.
Intl.PluralRules
The Intl.PluralRules API creates a locale-aware object that tells you which of the language's pluralization rules apply based on a given number.
Intl.RelativeTimeFormat
The Intl.RelativeTimeFormat API creates a locale-aware formatter that turns an object representing a relative time (such as '1 day ago') into a localized string.
Intl
The Intl API provides language sensitive string comparison, number formatting, date and time formatting, and more.
Intl.Locale
The Intl.Locale API parses Unicode locale identifiers, with language, region, and script codes, such as zh-Hans-CN or en-GB.
Async iterators and the for await..of loop
Asynchronous iterator objects, such as those returned by promises or generator functions, are iterable with the for await .. of loop.
Iterators and the for...of loop
The for...of loop operates on a sequence of values sourced from an iterable object, such as arrays, array-like objects, DOM collections, iterators, generators, and user-defined iterables. All built-in iterators inherit from the Iterator class.
Typed array iterators
Typed arrays are iterable with the for … of statement and enumerable with the methods entries(), keys(), and values().
Async generators
Async generator functions (async function*) create iterators that return multiple promises, one after another, on-demand.
BigInt
The BigInt JavaScript type represents integers of any size, including integers too large for the primitive Number type.
BigInt64Array
The BigInt64Array and BigUint64Array typed arrays represent 64-bit integers, signed and unsigned respectively.
Classes
Classes are an object-oriented syntax for JavaScript prototypes.
Destructuring
The destructuring assignment syntax is a JavaScript expression that unpacks values from arrays, or properties from objects, into distinct variables.
Error cause
The cause property of errors records the specific original cause of the error, particularly for errors that have been re-thrown.
Exponentiation operator
The exponentiation (**) operator returns the result of raising the first operand to the power of the second operand.
Functions
Functions are series of statements that can be called and return a value. The function keyword (as in function () { }) and arrow (=>) expression create functions. The JavaScript functions protocol includes default and rest parameters and binding to this.
Generators
Generator functions (function*) create iterators that return multiple values, one after another, on-demand.
globalThis
The globalThis property accesses the global this value (and hence the global object itself) across environments.
Hashbang comments
The #! comment at the absolute start of a script or module is treated as a normal comment and is ignored by the JavaScript engine.
JavaScript (initial core language support)
JavaScript is a programming language that runs in browsers, usually through the <script> element. JavaScript has changed over many years. This feature represents the oldest language features, such as built-in objects, statements, and operators. Also known as ECMAScript.
Let and const
The let and const declarations define block-scoped variables.
Logical assignments
The logical AND assignment (&&=) and the logical OR assignment (||=) operators short-circuit the respective binary logical operators.
Nullish coalescing
The nullish coalescing (??) and nullish coalescing assignment (??=) operators return (or assign) its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.
Numeric separators
To improve readability for numeric literals, underscores (_) can be used as separators. For example, 1_050.95 is equivalent to 1050.95.
Optional catch binding
Omit the the binding parameter of a catch clause when you don't need information about the exception in a try ... catch statement.
Proxy and Reflect
The Proxy and Reflect JavaScript built-ins intercept and define custom behavior for fundamental language operations (such as property lookup, assignment, enumeration, or function invocation).
SharedArrayBuffer and Atomics
The SharedArrayBuffer object represents bytes shared between multiple workers and the main thread. The Atomics object safely accesses SharedArrayBuffer data to make sure predictable values are read and written and that operations are not interrupted.
Template literals
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded expressions, and special constructs called tagged templates.
Unicode point escapes
Unicode point escapes (\\u{}) represent Unicode characters within strings.
Weak references
The WeakRef and FinalizationRegistry objects hold references to garbage-collectable objects without creating strong references that prevent their garbage collection.
Map (initial support)
Map objects hold key-value pairs and remember the original insertion order of the keys.
Set (initial support)
Set objects store unique values of any type.
JavaScript modules
JavaScript modules allow code to be organized into reusable units. Modules use import to load other modules and export to declare what is available to import from other modules. In HTML, modules are loaded with <script type="module">.
JavaScript modules in workers
The Worker() constructor accepts { type: "module" } to load scripts that use import and export. Also known as ECMAScript modules or ESM in workers.
Object
Objects in JavaScript are collections of key-value pairs.
Object.hasOwn()
The Object.hasOwn() static method checks whether an object has a given property. It's a more robust alternative to the Object.prototype.hasOwnProperty() method.
Date
The Date object represents a single moment in time.
Math and numbers
The number type (and Number object) represents floating-point numbers, such as 42 or -4.201, while the Math API contains mathematical functions and constants. JavaScript can also represent boundless negative and positive values as Infinity or not-a-number as NaN (as in 0 * Infinity).
String (initial support)
The string type (and String object) represents a sequence of characters.
Symbol
A Symbol value is a unique, non-enumerable primitive value used for encapsulation or information hiding. For example, a symbol can be a key of an object that can never collide with any other key.
String at()
The at() method of strings returns the character (one UTF-16 code unit) at an index, including negative indices for getting the character relative to the end of the string. Also known as the relative indexing method.
String codePointAt() and fromCodePoint()
The codePointAt() method returns the numeric value of the UTF-16 code point at an index of the string. The fromCodePoint() method returns a string created from one or more code points.
String includes()
The includes() method of strings returns whether a search string appears within the string.
String matchAll()
The matchAll() method of strings matches a string against a regular expression and returns an iterator of all results, including capturing groups.
String normalize()
The normalize() method of strings returns a Unicode normal form of a string as a new string. More than one code point sequence can represent the same characters. You can use the normalize() method to find canonically or compatibly equivalent strings.
String padStart() and padEnd()
The padStart() and padEnd() methods of strings return a string lengthened to a minimum number of characters by adding characters to the start or end of the string.
String raw()
The String.raw() static method interpolates template literal substitutions, but ignores escape sequences. It is the tag function for template literals.
String repeat()
The repeat() method of strings returns the original string repeated a number of times.
String replaceAll()
The replaceAll() method of strings returns a new string where all matches of a pattern (a string or regular expression) have been substituted with a replacement string.
String startsWith() and endsWith()
The startsWith() and endsWith() methods of strings returns whether a search string appears at the beginning or end of the provided string.
String trimStart() and trimEnd()
The trimStart() and trimEnd() methods of strings return a new string with whitespace removed from the beginning or end of the string.
Spread syntax
The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected.
Regular expressions
The RegExp object represents a regular expression, a notation for matching text patterns.
Typed array iteration methods
Typed array iteration methods
Typed arrays (initial support)
Typed arrays are ordered lists of JavaScript values, where all values are of the same numerical type, such as 8-bit integers or 32-bit floating point numbers.
WeakMap
A WeakMap object holds key-value pairs that do not create strong references to its keys, such that value data can be associated with a key without preventing garbage collection of the key.
WeakSet
A WeakSet object stores unique values of any type without creating strong references to the values, such that membership in the set does not prevent garbage collection of the value.
Available with conditions
Newly availableArray grouping
The Object.groupBy() and Map.groupBy() static methods group values of arrays and iterables based on a function that returns a key for each value.
Array.fromAsync()
The Array.fromAsync() static method copies items from an async iterable object to make a new array.
Promise.withResolvers()
The Promise.withResolvers() static method is an alternative to the Promise() constructor that returns both the promise and resolution functions. You can use this to access resolve and reject outside the scope of the executor function.
Promise.try()
The Promise.try() static method returns a promise that takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.
Intl.Segmenter
The Intl.Segmenter API creates a locale-aware text splitter that can separate a string into meaningful graphemes, words, or sentences.
Intl.DurationFormat
The Intl.DurationFormat API creates a locale-aware formatter that turns an object representing a duration (such as days, hours, and minutes) into a string.
Iterator methods
The Iterator object is an abstract base for objects that implement the iterator protocol. It provides methods common to built-in iterators, such as filter(), find(), map(), and reduce(). You can also use the static method Iterator.from() to convert an existing iterable into an Iterator.
Iterator.concat()
The Iterator.concat() JavaScript method returns an iterator that yields values from a sequence of iterators, exhausting each iterator before moving on to the next.
JSON import attributes
Module import … with { type: "json" } statements load JSON data. Also known as JSON module scripts.
JSON source text access
To serialize and parse JSON in a lossless way, JSON.stringify() handles rawJSON values and JSON.parse()'s reviver callback takes a source context parameter.
Atomics.pause()
The Atomics.pause() static method gives a hint to the CPU that the code calling the method is in a short-duration wait for shared memory, known as spinning or a spinlock.
Atomics.waitAsync()
The Atomics.waitAsync() static method waits for a value in a shared memory location, providing a promise when the expected value is not yet in memory. The waitAsync() method is a non-blocking alternative to Atomics.wait().
Resizable buffers
The resize() method of an ArrayBuffer and the grow() method of a SharedArrayBuffer, constructed with the maxByteLength option, changes the size of the buffer in place.
Transferable ArrayBuffer
The transfer() and transferToFixedLength() methods of ArrayBuffer move a buffer from one context to another (for example, to a worker).
Map getOrInsert()
The getOrInsert() and getOrInsertComputed() methods of Map objects get a value, setting and getting a default value if needed.
Set methods
The difference(), intersection(), isDisjointFrom(), isSubsetOf(), isSupersetOf(), symmetricDifference(), and union() methods of the JavaScript Set object performs operations between two sets.
JavaScript modules in service workers
The navigator.serviceWorker.register() method accepts { type: "module" } to load scripts that use import and export. Also known as ECMAScript modules or ESM in service workers.
String isWellFormed() and toWellFormed()
The isWellFormed() method of strings returns a boolean indicating if the string contains any Unicode lone surrogates. The toWellFormed() method returns a new string where all lone surrogates are replaced by the Unicode replacement character.
RegExp.escape()
The RegExp.escape() static method takes a string and replaces any characters that are potentially special characters of a regular expression with equivalent escape sequences. For example, RegExp.escape("[abc]") returns "\\[abc\\]".
Float16Array
Float16Array is a typed array of 16-bit floating point numbers.
Uint8Array base64 and hex conversion
The Uint8Array object methods fromBase64(), toBase64(), and setFromBase64() convert to and from base64 strings. The fromHex(), toHex(), and setFromHex() methods convert to and from hex strings.
Limited support
Limited supportSerializable errors
The DOMException, Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, and URIError objects are serializable. You can call structuredClone() on an error object or pass it to a worker using postMessage().
Intl.Locale info
The getter methods of the Intl.Locale API provide supplemental information about a Unicode locale, such as the locale's calendar (for example, the first day in a week or the weekend start day), writing direction, 12- or 24-hour cycles, and numbering system.
__proto__
The __proto__ property of objects partially exposes the prototype of an object.
Accessor methods
The __defineGetter__() and __defineSetter__() methods of objects bind a function to a property, which is called on setting or reading the property.
arguments.callee
The callee property of the arguments variable in a non-strict function body's local scope is the function that arguments belongs to.
Error.isError()
The Error.isError() static method checks whether a value is an Error object.
escape() and unescape()
The escape() and unescape() built-in Javascript methods encode and unencode strings using percent encoding, where certain characters are replaced by hexadecimal escape sequences.
Function caller and arguments
The caller and arguments properties of a non-strict mode Function object are the function that called it and the arguments it was called with. Not to be confused with the arguments variable in a function body's local scope.
getYear() and setYear()
The getYear() and setYear() methods of Date objects get and set the year as an offset to 1900.
HTML wrapper methods
JavaScript built-in methods such as, String.bold() and String.italics(), wrap strings in (often historic) HTML.
Math.sumPrecise()
The Math.sumPrecise() static method returns the sum of an iterable of numbers. It avoids the precision loss of intermediate partial sums, as found using reduce() or a loop to add together an array of values.
Temporal
The Temporal API allows you to work with dates, times, time zones, and durations. It is more powerful than the Date API.
toGMTString()
The toGMTString() method of Date objects is an alias to the toUTCString() method.
Top-level await
The await keyword, when used at the top level of a module (outside of an async function), delays parent module execution until after a promise fulfills.
with
The with JavaScript statement adds a given object to the chain of scopes used to evaluate names.
CSS import attributes
Module import … with { type: "css" } statements load CSS modules as constructable stylesheets. Also known as CSS module scripts.
Import assertions
Module import … assert { type: "json" } and import … assert { type: "css" } JavaScript statements load JSON and CSS data.
RegExp compile()
The compile() method of RegExp objects recompiles an existing regular expression object using a new pattern and flags.
RegExp static properties
The RegExp object has several static properties to access the input and results of the most-recent regular expression match.
Explicit resource management
The using and await using declarations and the dispose and asyncDispose symbols manage the lifecycle of resources such as file handles and streams. The DisposableStack and AsyncDisposableStack objects can group, dispose, and coordinate dependencies between multiple disposable resources.