Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

JavaScript API reference

modern JavaScript (ES2024+)

Identifiers
100
With full guides
96
Types
5

Topics covered

  • Closures
  • Event loop & microtasks
  • Promises & async/await
  • Prototypes & classes
  • ES modules
  • Iterators & generators
  • Proxy & Reflect
  • Memory & GC

Class

NameWhat it does
ArrayThe JavaScript Array object stores an ordered collection of values under one variable name. Arrays are zero-indexed, resizable, can mix value types, and provide methods for common collection operations.
ObjectObject is JavaScript’s general-purpose object type for keyed collections and complex entities. Objects are commonly created with literals and usually inherit from Object.prototype.
PromisePromise represents the eventual completion or failure of asynchronous work and its resulting value. It progresses from pending to fulfilled or rejected and supports handler-based chaining.
MapMap stores unique key-value pairs and preserves key insertion order. Any JavaScript value can be used as a key or a value.
SetSet stores unique values of any type, including primitives and object references. It preserves successful insertion order and provides methods for adding, removing, testing, and iterating values.
ProxyThe Proxy() constructor creates a proxy that wraps a target object and can intercept selected fundamental operations. A handler supplies trap functions for customizing those operations.
SymbolSymbol is a built-in function that creates unique, immutable primitive values. Symbols can serve as non-colliding object property keys, while Symbol.for() provides shared values through the global symbol registry.
WeakMapWeakMap stores values using objects or non-registered symbols as keys without strongly retaining those keys. It is useful for object-associated data that should disappear as the key becomes unreachable.
DateThe JavaScript Date class represents a single instant as milliseconds from the UTC epoch. It offers constructors, static timestamp utilities, and local or UTC accessors and formatters.
RegExpRegExp represents a pattern for matching text. Create it with literal syntax or the constructor, then use it with RegExp and String matching methods.
AbortControllerClass
URLThe URL interface parses, constructs, normalizes, and encodes URLs. It exposes URL components for inspection and modification, and can resolve relative references against a base URL.
URLSearchParamsURLSearchParams provides utility methods for working with a URL's query string. Its iterable instances preserve ordered name-value pairs and can be modified or serialized.
ErrorThe Error constructor creates Error objects that describe failures. It accepts an optional message and an options object for preserving an underlying cause, and it can be called with or without new.
WeakSetWeakSet is a collection of unique objects and non-registered symbols held weakly, so unreachable members may be garbage-collected. It supports membership checks and mutation but cannot be enumerated.
DataViewDataView provides low-level, typed access to binary data stored in an ArrayBuffer or SharedArrayBuffer. It supports explicit endianness and arbitrary byte offsets for multi-byte values.
ArrayBufferArrayBuffer represents raw binary storage as a sequence of bytes. Access its contents through a typed-array view or DataView; it can also be created as resizable and transferred between execution contexts.
FunctionThe Function() constructor dynamically creates a callable Function object from parameter names and a function-body string. It runs in the global scope rather than capturing the local scope where it was created.
WeakRefWeakRef provides a non-owning reference to an object or non-registered symbol, so the target may be garbage-collected. Use deref() to retrieve the target when it is still available; garbage-collection timing is nondeterministic.
FinalizationRegistryFinalizationRegistry lets you request a cleanup callback after a registered value is garbage-collected. Callback execution and timing are controlled by the JavaScript engine and are not guaranteed.
SharedArrayBufferSharedArrayBuffer represents raw binary memory that multiple execution contexts can access through typed-array views. Use structured cloning to share it and Atomics to coordinate concurrent access.
IteratorIterator is the abstract base class for JavaScript iterator objects. Subclass it to implement next(), then use its iterable behavior and lazy helper methods to process sequences.

Function

NameWhat it does
fetchfetch() starts an asynchronous resource request and returns a promise for a Response. The promise can fulfill for HTTP error statuses, so inspect the response status before treating the request as successful.
structuredClonestructuredClone() creates a deep clone of a structured-cloneable JavaScript value. Its optional transfer list can move transferable resources into the clone instead of copying them.
BigIntBigInt(value) converts a supported value into a primitive BigInt. It accepts integer-like values, strings, booleans, and BigInts, but rejects fractional Numbers and cannot be called with new.
queueMicrotaskqueueMicrotask() schedules a function as a microtask. The function runs after the current task completes, before control returns to the event loop.
Object.entriesObject.entries() returns an array of [key, value] pairs for an object's own enumerable string-keyed properties. It excludes inherited properties and preserves the standard property-enumeration order.
Object.fromEntriesObject.fromEntries() creates a new object from an iterable of key-value pairs. It accepts sources such as arrays and Maps, including entries with symbol keys.
Promise.allPromise.all() combines an iterable of promises or values into one promise. It fulfills with results in input order only when every item fulfills, and rejects as soon as an item rejects.
Promise.allSettledPromise.allSettled() waits for every input promise to settle and fulfills with an input-ordered array describing each result. It reports both successes and failures instead of rejecting because one input failed.
Promise.racePromise.race() returns a promise whose outcome follows the first item in an iterable to settle, whether fulfillment or rejection. It always settles asynchronously and remains pending when given an empty iterable.
Array.fromArray.from() creates a new Array from an iterable or array-like object. An optional callback can transform each value as the result is built.
mapFunction
filterFunction
reduceFunction
forEachArray.prototype.forEach() invokes a callback once for each assigned array element in ascending-index order. It returns undefined and is mainly used to perform side effects.
findfind() returns the first array element for which a testing callback returns a truthy value. If no element matches, it returns undefined.
findIndexArray.prototype.findIndex() returns the index of the first array element whose testing function returns a truthy value. It returns -1 when no element matches.
someArray.prototype.some() tests whether at least one array element satisfies a callback. It returns true on the first truthy result and otherwise returns false.
everyArray.prototype.every() tests array elements with a predicate and returns true only if every visited element passes. It stops at the first failure and returns false; an empty array returns true.
flatArray.prototype.flat() creates a new array by recursively concatenating nested arrays up to a chosen depth. Without an argument, it flattens one level.
flatMapArray.prototype.flatMap() maps each array element and flattens each callback result by one level. It returns a new array and does not recursively flatten deeper nesting.
includesString.prototype.includes() performs a case-sensitive substring search and reports whether the requested text occurs in a string. It returns a boolean and accepts an optional starting position.
sliceString.prototype.slice() returns a selected section of a string as a new string. The start is inclusive, the end is exclusive, and the original string remains unchanged.
splicesplice() changes an array in place by removing, replacing, and/or inserting elements. It returns a new array containing the elements removed.
concatArray.prototype.concat() returns a new array formed from the calling array and supplied arrays or values. It does not mutate the source arrays and spreads array arguments only one level.
joinArray.prototype.join() returns a new string made by concatenating an array's elements, separated by commas or a chosen string. It returns an empty string for an empty array.
sortArray.prototype.sort() sorts an array in place and returns the same array. By default it compares string representations in UTF-16 order; pass a comparator for custom ordering.
reverseArray.prototype.reverse() reverses an array in place and returns the same array reference. Use toReversed() or copy the array first when the original must remain unchanged.
indexOfArray.prototype.indexOf() returns the first index where a value occurs in an array, or -1 when it is absent. It optionally accepts a starting index and uses strict equality for matching.
fillArray.prototype.fill() replaces elements in a selected index range with one static value. It mutates the array and returns the modified array.
atArray.prototype.at() returns the element at a given integer index and supports negative indexes that count from the end. It returns undefined when the index is outside the array's bounds.
splitString.prototype.split() searches a string for a separator and returns an array of the substrings between matches. The separator may be a string, regular expression, or custom object with Symbol.split; an optional limit caps the result length.
replaceString.prototype.replace() returns a new string with matching text replaced. String patterns replace only the first occurrence; use a global regular expression or replaceAll() for all occurrences.
replaceAllString.prototype.replaceAll() returns a new string in which every match of a string or replacement pattern is replaced. It leaves the original string unchanged.
trimtrim() returns a new string with whitespace and line terminators removed from both ends of the string. It leaves the original string unchanged.
padStartString.prototype.padStart() adds characters to the beginning of a string until it reaches a requested length. The optional padding text is repeated or truncated as needed.
padEndString.prototype.padEnd() appends repeated and, if necessary, truncated filler so a string reaches a requested length. It leaves strings already at least that long unchanged.
startsWithString.prototype.startsWith() checks whether a string begins with a specified string and returns a boolean. An optional position lets the check begin at a later index.
endsWithDetermines whether a string ends with a specified string and returns true or false. An optional end position lets you test a portion of the string.
repeatString.prototype.repeat() returns a new string containing the receiver repeated a specified number of times. The count is converted to an integer and invalid or excessive counts throw RangeError.
matchAllString.prototype.matchAll() returns an iterator over every match of a pattern in a string, including capture groups. Consume it with standard iteration tools such as for...of or Array.from().
Object.keysObject.keys() returns an array of an object's own enumerable string-keyed property names. It excludes inherited and non-enumerable properties.
Object.valuesObject.values() returns an array of an object's own enumerable string-keyed property values. It excludes inherited and symbol-keyed properties.
Object.assignObject.assign() copies enumerable own properties from one or more sources into a target object. It mutates and returns the target, with later sources winning when keys overlap.
Object.freezeObject.freeze() prevents extensions and locks an object's existing properties. It returns the same object reference and does not recursively freeze nested objects.
Object.createObject.create() creates a new object with a chosen prototype. An optional descriptor map defines its own properties with precise attribute control.
Object.definePropertyDefines or modifies an object's own property with a descriptor, controlling its value, accessors, and property flags. On success, it returns the original object.
Object.getPrototypeOfObject.getPrototypeOf() returns the internal [[Prototype]] of a value. Its result is an object or null; modern JavaScript coerces primitive arguments to wrapper objects before retrieving the prototype.
Math.maxMath.max() returns the greatest value among its arguments. It returns -Infinity with no arguments and NaN when any argument is or converts to NaN.
Math.minMath.min() returns the smallest of zero or more supplied values. It returns Infinity with no arguments and NaN if any argument is or converts to NaN.
Math.roundMath.round() returns a number rounded to the nearest integer. Exact halves round toward positive infinity, so -3.5 becomes -3 and 3.5 becomes 4.
Math.floorMath.floor() returns the largest integer less than or equal to a number. Unlike truncation, it rounds negative fractional values toward negative infinity.
Math.ceilMath.ceil() returns the smallest integer greater than or equal to a number. It rounds toward positive infinity, so negative fractional values move toward zero.
Math.randomMath.random() returns an approximately uniformly distributed pseudo-random floating-point number from 0 inclusive to 1 exclusive. It accepts no arguments and is not suitable for cryptographic security.
Math.absMath.abs() returns the absolute value of a number. It converts its argument to a Number and returns a non-negative result, or NaN when conversion is not possible.
Math.powMath.pow() returns a base raised to an exponent. It is a static Math method that accepts numeric arguments and returns a Number.
Number.isIntegerNumber.isInteger() tests whether a value is a Number representing an integer. It does not coerce non-number values and returns false for NaN and infinities.
parseIntparseInt() converts a value to a string and parses an integer in a specified radix. It returns the parsed integer or NaN when the radix is invalid or no initial numeric characters can be parsed.
parseFloatparseFloat() converts its argument to a string and parses the longest valid decimal-number prefix. It returns the resulting floating-point number, Infinity, or NaN when parsing cannot begin.
isFiniteNumber.isFinite() checks whether a value is a finite JavaScript number. It returns false for non-numbers, NaN, and positive or negative infinity.
Promise.resolvePromise.resolve(value) converts a value, promise, or thenable into a Promise. It reuses eligible existing promises, assimilates thenables, and fulfills with ordinary values.
Promise.rejectPromise.reject() creates and returns a new promise that is already rejected with the supplied reason. It is useful for producing rejection branches or adapting a value into a rejected promise.
Promise.anyPromise.any() returns a promise fulfilled by the first input that fulfills. It rejects with AggregateError when every input rejects, including an empty iterable.
Promise.withResolversPromise.withResolvers() returns a new promise together with the resolve and reject functions that control it. This makes it convenient to settle a promise from code outside its constructor executor.
Array.fromAsyncArray.fromAsync() builds a new array from an async iterable, iterable, or array-like object. It returns a promise and awaits source values and optional mapping results.
Object.groupByObject.groupBy() groups an iterable's elements by keys returned from a callback. It returns a null-prototype object whose properties contain arrays of the original elements for each group.
Map.groupByMap.groupBy() groups an iterable's elements by callback results and returns a Map from each group key to its matching elements. Unlike Object.groupBy(), it can use arbitrary object or primitive keys.
String.rawString.raw() creates a string from a template literal without interpreting its escape sequences. Interpolated expressions are still evaluated and inserted.
Array.ofArray.of() creates a new array from its arguments, regardless of how many arguments there are or what types they have. A single number is stored as an element, unlike with Array().
Object.hasOwnObject.hasOwn() returns whether an object contains a specified property as its own property. It excludes inherited properties and works with null-prototype objects.

Type Alias

NameWhat it does
AsyncIteratorAsyncIterator is an object whose next() method returns a promise for an iterator result. Built-in async iterators inherit from AsyncIterator.prototype, which makes them usable as async iterables.
GeneratorA Generator is the iterator object produced by a generator function. It combines iterable and iterator behavior, allowing execution to pause at yield and resume later.
AsyncGeneratorAsyncGenerator is the object produced by calling an async generator function. It is both an async iterable and async iterator, and its methods return promises.

Const

NameWhat it does
globalThisglobalThis is the portable global property for accessing JavaScript's global this value. It works in both window and non-window contexts, although hosts and browsers may implement its identity differently.
AtomicsAtomics is a namespace of static methods for atomic operations on typed-array elements, including shared-memory synchronization. It is commonly used with SharedArrayBuffer to coordinate concurrent agents safely.

Module

NameWhat it does
ReflectReflect is a namespace object containing static methods that invoke interceptable JavaScript object operations. It is primarily used to forward default behavior from Proxy traps.
JSONThe global JSON namespace provides static methods for parsing JSON text and converting JavaScript values to JSON. It is not a constructor; use methods such as JSON.parse() and JSON.stringify().
IntlIntl is the namespace for JavaScript's ECMAScript Internationalization API. Its constructors and utilities provide locale-sensitive comparison, formatting, and other language-aware operations.
MathMath is JavaScript’s built-in namespace for mathematical constants and functions operating on Number values. Its members are static, so use Math directly rather than constructing or calling it.

Search across every package and filter by type in your dashboard.

Start learning