JavaScript Tutorial
Learn JavaScript
The programming language of the web.
01
JavaScript Basics
04
Operators
06
Numbers & Math
10
Conditionals
13
Array Iteration Methods
14
Asynchronous JavaScript
15
Operators in Depth
- Arithmetic & Exponentiation
- == vs === and Coercion
- Logical Operators & Short-Circuit
- Nullish Coalescing ??
- Optional Chaining ?.
- The Ternary Operator, Used Well
- Bitwise Operators
- Spread & Rest in Depth
- Destructuring, Every Corner
- The Comma Operator
- typeof & instanceof
- Logical Assignment ??= &&= ||=
- Operator Precedence & Associativity
16
Functions, Scope & this
JavaScript Reference
295 pages · 13 groups · syntax, parameters and worked examples
Array Methods39
Array.prototype.map()Builds a new array by running a function over every element of the original.Array.prototype.filter()Returns a new array holding only the elements for which the callback returns a truthy value.Array.prototype.reduce()Folds an array left to right into a single accumulated value.Array.prototype.reduceRight()Folds an array into a single value, visiting elements from the last index to the first.Array.prototype.forEach()Runs a function once for each array element, for its side effects only.Array.prototype.find()Returns the first element that satisfies the test, or undefined if none does.Array.prototype.findIndex()Returns the index of the first element passing the test, or -1 if none does.Array.prototype.findLast()Returns the last element that satisfies the test, searching from the end backwards.Array.prototype.findLastIndex()Returns the index of the last element passing the test, or -1 if none does.Array.prototype.includes()Determines whether an array contains a given value, returning true or false.Array.prototype.indexOf()Returns the first index at which a value is found, or -1 if it is absent.Array.prototype.lastIndexOf()Returns the last index at which a value is found, searching backwards from the end.Array.prototype.some()Tests whether at least one element in an array passes a callback test, short-circuiting on the first match.Array.prototype.every()Tests whether all elements in an array pass a callback test, short-circuiting on the first failure.Array.prototype.slice()Returns a shallow copy of a portion of an array selected by start and end indices, leaving the original intact.Array.prototype.splice()Removes, replaces, or inserts elements in place and returns an array of the removed elements.Array.prototype.concat()Merges arrays and values into a new array without modifying any of the inputs.Array.prototype.join()Concatenates all array elements into a single string, separated by the given separator.Array.prototype.push()Adds one or more elements to the end of an array and returns the array's new length.Array.prototype.pop()Removes the last element from an array and returns it, shortening the array by one.Array.prototype.shift()Removes the first element from an array and returns it, shifting all remaining elements down.Array.prototype.unshift()Adds one or more elements to the beginning of an array and returns the array's new length.Array.prototype.sort()Sorts an array in place, comparing elements as strings unless a comparator function is supplied.Array.prototype.reverse()Reverses the order of an array's elements in place and returns a reference to that same array.Array.prototype.flat()Returns a new array with nested sub-arrays merged into it, up to a chosen depth.Array.prototype.flatMap()Maps each element to zero or more values and flattens the results one level into a new array.Array.prototype.fill()Overwrites a range of an array in place with a single static value and returns that array.Array.prototype.at()Returns the element at an index, counting back from the end when the index is negative.Array.prototype.with()Returns a copy of the array with the element at one index replaced by a new value.Array.prototype.toSorted()Returns a sorted copy of an array, leaving the original in its existing order.Array.prototype.toReversed()Returns a new array with the elements in reverse order, leaving the original untouched.Array.prototype.toSpliced()Returns a copy of the array with elements removed at an index and optional new elements inserted.Array.prototype.keys()Returns an iterator over every index of the array, including empty slots.Array.prototype.values()Returns an iterator that yields each element of the array in order.Array.prototype.entries()Returns an iterator of [index, element] pairs, one for each position in the array.Array.prototype.lengthHolds the number of elements in an array, and truncates or extends it when assigned.Array.from()Creates a new array from an iterable or array-like object, optionally mapping each value as it goes.Array.of()Creates a new array from its arguments, regardless of how many there are or what type they have.Array.isArray()Determines whether a value is an array, reliably and across realms.
String Methods34
String.prototype.lengthReturns the number of UTF-16 code units in a string, not the number of visible characters.String.prototype.at()Returns the character at an index, counting back from the end when the index is negative.String.prototype.charAt()Returns the single UTF-16 code unit at a given index, or an empty string when the index is out of range.String.prototype.charCodeAt()Returns the numeric UTF-16 code unit value of the character at a given index, or NaN if out of range.String.prototype.codePointAt()Returns the full Unicode code point at an index, keeping surrogate pairs such as emoji intact.String.prototype.concat()Joins one or more values onto the end of a string and returns the combined new string.String.prototype.includes()Tests whether a string contains a given substring, returning true or false.String.prototype.indexOf()Returns the index of the first occurrence of a substring, or -1 when it is not found.String.prototype.lastIndexOf()Returns the index of the last occurrence of a substring, searching backwards from the end.String.prototype.startsWith()Tests whether a string begins with the given characters, returning true or false.String.prototype.endsWith()Tests whether a string ends with the given characters, returning true or false.String.prototype.slice()Extracts a section of a string into a new string, accepting negative indexes that count from the end.String.prototype.substring()Extracts the characters between two indices and returns them as a new string.String.prototype.substr()Extracts a run of characters of a given length starting at an index (deprecated).String.prototype.split()Divides a string into an array of substrings using a separator string or regular expression.String.prototype.replace()Returns a new string with the first match of a pattern swapped for a replacement.String.prototype.replaceAll()Returns a new string with every match of a pattern swapped for a replacement.String.prototype.match()Matches a string against a regular expression and returns the results, or null.String.prototype.matchAll()Returns an iterator of every regex match, each with its capture groups and index.String.prototype.search()Returns the index of the first regular expression match, or -1 if there is none.String.prototype.trim()Removes whitespace and line terminators from both ends of a string.String.prototype.trimStart()Removes whitespace and line terminators from the beginning of a string.String.prototype.trimEnd()Removes whitespace and line terminators from the end of a string.String.prototype.padStart()Pads a string from the start until it reaches a target length.String.prototype.padEnd()Pads a string on the right with a repeated filler until it reaches a target length.String.prototype.repeat()Returns a new string containing a given number of copies of the original string.String.prototype.toLowerCase()Returns a new string with every character converted to lower case using locale-independent rules.String.prototype.toUpperCase()Returns a new string with every character converted to upper case using locale-independent rules.String.prototype.normalize()Returns the Unicode Normalization Form of a string so equivalent spellings compare equal.String.prototype.localeCompare()Compares two strings in a language-aware order and returns a negative, zero, or positive number.String.prototype.toString()Returns the primitive string value of a String object or string primitive.String.fromCharCode()Builds a string from a sequence of UTF-16 code unit numbers.String.fromCodePoint()Builds a string from a sequence of Unicode code points, including astral characters like emoji.String.raw()Returns a template literal's text with backslash escape sequences left uninterpreted.
Object Statics23
Object.keys()Returns an array of an object's own enumerable string-keyed property names.Object.values()Returns an array of an object's own enumerable string-keyed property values.Object.entries()Returns an array of an object's own enumerable string-keyed [key, value] pairs.Object.fromEntries()Builds an object from an iterable of [key, value] pairs, such as an array or a Map.Object.assign()Copies own enumerable properties from source objects onto a target object and returns it.Object.create()Creates a new object with the given prototype and optional property descriptors.Object.freeze()Freezes an object so its properties cannot be added, removed, reassigned or reconfigured.Object.isFrozen()Determines whether an object is frozen — non-extensible with no configurable or writable properties.Object.seal()Seals an object so properties cannot be added or removed, while existing values stay writable.Object.isSealed()Determines whether an object is sealed — non-extensible with all properties non-configurable.Object.preventExtensions()Prevents new properties from ever being added to an object and locks its prototype.Object.isExtensible()Determines whether new properties can still be added to an object.Object.defineProperty()Defines or modifies one property on an object with exact control over its attributes.Object.getOwnPropertyDescriptor()Returns the full attribute record for one own property, or undefined if it is not there.Object.getOwnPropertyNames()Returns every own string-keyed property name, including the non-enumerable ones Object.keys skips.Object.getPrototypeOf()Returns the prototype of an object, or null at the end of the prototype chain.Object.setPrototypeOf()Sets the prototype of an existing object to another object or to null.Object.is()Compares two values for same-value equality, treating NaN as equal and +0 as distinct from -0.Object.hasOwn()Reports whether an object has the given property as its own, ignoring the prototype chain.Object.groupBy()Groups the items of an iterable into a null-prototype object keyed by a callback's return value.Object.prototype.hasOwnProperty()Tests whether the object has the given property as its own rather than inheriting it.Object.prototype.isPrototypeOf()Tests whether the calling object appears anywhere in another object's prototype chain.Object.prototype.toString()Returns a bracketed type tag such as [object Array] describing the object's internal kind.
Number19
Number.prototype.toFixed()Formats a number with a fixed number of decimal places and returns it as a string.Number.prototype.toPrecision()Formats a number to a set count of significant digits and returns it as a string.Number.prototype.toExponential()Formats a number in exponential notation with one digit before the decimal point.Number.prototype.toString()Converts a number to a string, optionally in any base from 2 to 36.Number.prototype.toLocaleString()Formats a number using locale conventions for grouping, decimals, currency and percent.Number.isInteger()Tests whether a value is a number with no fractional part.Number.isFinite()Tests whether a value is a number that is neither Infinity, -Infinity nor NaN.Number.isNaN()Tests whether a value is the number NaN, without coercing anything else.Number.isSafeInteger()Tests whether a value is an integer that IEEE-754 doubles can represent exactly.Number.parseInt()Parses a leading integer out of a string, in a base you choose.Number.parseFloat()Parses a leading decimal number, including exponents, out of a string.Number.EPSILONHolds the smallest gap between 1 and the next representable double, about 2.22e-16.Number.MAX_SAFE_INTEGERHolds the largest integer JavaScript can represent exactly, 2^53 - 1.Number.MIN_SAFE_INTEGERHolds the smallest integer JavaScript can represent exactly, -(2^53 - 1).Number.MAX_VALUEHolds the largest finite number JavaScript can represent, about 1.7976931348623157e+308.Number.MIN_VALUEHolds the smallest positive number JavaScript can represent, about 5e-324.Number.POSITIVE_INFINITYHolds positive infinity, the value arithmetic collapses to when it overflows the finite range.Number.NEGATIVE_INFINITYHolds negative infinity, the value returned when arithmetic overflows below the finite range.Number.NaNHolds the Not-A-Number value, the result of arithmetic that has no meaningful numeric answer.
Math29
Math.abs()Returns the absolute value of a number, discarding its sign.Math.ceil()Rounds a number up to the smallest integer greater than or equal to it.Math.floor()Rounds a number down to the largest integer less than or equal to it.Math.round()Rounds a number to the nearest integer, breaking ties toward positive infinity.Math.trunc()Removes the fractional digits from a number, truncating toward zero.Math.max()Returns the largest of the numbers passed to it, or -Infinity when given none.Math.min()Returns the smallest of the numbers passed to it, or Infinity when given none.Math.pow()Raises a base to the power of an exponent and returns the result.Math.sqrt()Returns the square root of a number, or NaN when the number is negative.Math.cbrt()Returns the cube root of a number, handling negative input correctly.Math.random()Returns a pseudo-random floating-point number in the range 0 (inclusive) to 1 (exclusive).Math.sign()Returns 1, -1, 0, -0, or NaN indicating the sign of a number.Math.hypot()Returns the square root of the sum of squares of its arguments, without intermediate overflow.Math.exp()Returns e raised to the power of a number, the inverse of the natural logarithm.Math.log()Returns the natural logarithm (base e) of a number, the inverse of Math.exp().Math.log2()Returns the base 2 logarithm of a number — how many doublings it takes to reach it.Math.log10()Returns the base 10 logarithm of a number — the count of its digits or its order of magnitude.Math.sin()Returns the sine of an angle given in radians, a value between -1 and 1.Math.cos()Returns the cosine of an angle given in radians, a value between -1 and 1.Math.tan()Returns the tangent of an angle given in radians — the slope of the ray at that angle.Math.asin()Returns the arcsine of a number in radians, the inverse of Math.sin().Math.acos()Returns the arccosine of a number in radians, the inverse of Math.cos().Math.atan()Returns the arctangent of a number in radians, the angle whose tangent is that value.Math.atan2()Returns the angle in radians from the positive x-axis to the point (x, y), across all four quadrants.Math.PIHolds the ratio of a circle's circumference to its diameter, roughly 3.141592653589793.Math.EHolds Euler's number, the base of the natural logarithm, roughly 2.718281828459045.Math.SQRT2Holds the square root of 2, roughly 1.4142135623730951.Math.LN2Holds the natural logarithm of 2, roughly 0.6931471805599453.Math.LN10Holds the natural logarithm of 10, roughly 2.302585092994046.
JSON4
JSON.stringify()Converts a JavaScript value into a JSON string, with optional filtering and indentation.JSON.parse()Parses a JSON string into a JavaScript value, optionally transforming each value with a reviver.JSON.rawJSON()Creates a marker object whose exact JSON text is inserted verbatim during serialization.JSON.isRawJSON()Tests whether a value is a marker object produced by JSON.rawJSON().
Date32
new Date()Create a Date object from the current time, a timestamp, a string, or calendar components.Date.now()Return the current time as milliseconds elapsed since the Unix epoch.Date.parse()Convert a date string into a timestamp in milliseconds since the epoch.Date.UTC()Build a timestamp from calendar components interpreted as UTC rather than local time.Date.prototype.getFullYear()Return the four-digit year of a date according to local time.Date.prototype.getMonth()Return the zero-based month index of a date according to local time.Date.prototype.getDate()Return the day of the month for a date according to local time.Date.prototype.getDay()Return the day of the week for a date, where 0 is Sunday, according to local time.Date.prototype.getHours()Return the hour of a date in 24-hour form according to local time.Date.prototype.getMinutes()Return the minutes past the hour for a date according to local time.Date.prototype.getSeconds()Return the seconds past the minute for a date according to local time.Date.prototype.getMilliseconds()Return the milliseconds past the second for a date according to local time.Date.prototype.getTime()Returns the number of milliseconds since the Unix epoch for a Date, the standard way to compare dates.Date.prototype.getTimezoneOffset()Returns the difference in minutes between UTC and local time for the instant the date represents.Date.prototype.getUTCFullYear()Returns the four-digit year of a date according to universal time rather than local time.Date.prototype.getUTCMonth()Returns the zero-based month of a date according to universal time, 0 for January through 11 for December.Date.prototype.getUTCDate()Returns the day of the month of a date according to universal time, from 1 to 31.Date.prototype.setFullYear()Sets the year of a date in local time, optionally the month and day too, and returns the new timestamp.Date.prototype.setMonth()Sets the zero-based month of a date in local time and returns the new timestamp.Date.prototype.setDate()Sets the day of the month in local time, rolling into adjacent months when the value is out of range.Date.prototype.setHours()Sets the hours, and optionally minutes, seconds and milliseconds, of a date in local time.Date.prototype.setMinutes()Sets the minutes, and optionally seconds and milliseconds, of a date in local time.Date.prototype.setSeconds()Sets the seconds, and optionally milliseconds, of a date in local time and returns the new timestamp.Date.prototype.setTime()Sets a date to a given number of milliseconds since the Unix epoch, replacing its value entirely.Date.prototype.toISOString()Formats a date as a 24-character ISO 8601 string in UTC, always ending in Z.Date.prototype.toJSON()Returns the date as an ISO 8601 UTC string, or null when the date is invalid.Date.prototype.toString()Returns the full date and time as an English string interpreted in the host time zone.Date.prototype.toDateString()Returns just the date portion as an English string in the host time zone, dropping the time.Date.prototype.toUTCString()Returns the date as an RFC 7231 style UTC string, the format HTTP headers require.Date.prototype.toLocaleDateString()Formats the date portion using a locale's conventions, with optional time zone and style control.Date.prototype.toLocaleString()Formats both date and time using a locale's conventions, with optional time zone control.Date.prototype.valueOf()Returns the date's timestamp in milliseconds since the Unix epoch, or NaN if it is invalid.
Promise & Async15
new Promise()Creates a promise whose settlement you control with resolve and reject functions.Promise.prototype.then()Registers callbacks for a promise's fulfillment and rejection, returning a new chained promise.Promise.prototype.catch()Registers a handler for a promise's rejection and returns a promise for the recovered value.Promise.prototype.finally()Runs a callback once a promise settles either way, passing the outcome through unchanged.Promise.all()Waits for every promise in an iterable to fulfill, or rejects on the first failure.Promise.allSettled()Waits for every promise to settle and reports each outcome without ever rejecting.Promise.any()Fulfills with the first promise to succeed, ignoring rejections until every input has failed.Promise.race()Settles with the first promise to settle, whether that outcome is a fulfillment or a rejection.Promise.resolve()Returns a promise resolved with the given value, adopting it if it is already a thenable.Promise.reject()Returns a promise already rejected with the given reason, wrapping it without unwrapping.Promise.withResolvers()Creates a promise together with its resolve and reject functions in the same scope.Promise.try()Calls a function and captures its return value, thrown error, or promise in one promise.async functionDeclares a function that always returns a promise and may pause on await inside its body.awaitPauses an async function until a promise settles and evaluates to its fulfilled value.for await...ofLoops over an async iterable, awaiting each value before running the loop body.
Map & Set31
new Map()Creates a keyed collection where any value can be a key and insertion order is preserved.Map.prototype.set()Adds or overwrites an entry and returns the map, so calls can be chained.Map.prototype.get()Returns the value stored under a key, or undefined when the key is not present.Map.prototype.has()Reports whether the map contains an entry for the given key, returning true or false.Map.prototype.delete()Removes the entry for a key and returns whether an entry was actually removed.Map.prototype.clear()Removes every entry from the map in one call, leaving it empty but still the same object.Map.prototype.sizeReports how many entries the map currently holds, as a read-only accessor property.Map.prototype.keys()Returns an iterator over the map's keys in insertion order.Map.prototype.values()Returns an iterator over the map's values in insertion order.Map.prototype.entries()Returns an iterator over the map's [key, value] pairs in insertion order.Map.prototype.forEach()Runs a callback once for every entry, in insertion order, passing value before key.Map.groupBy()Groups the elements of an iterable into a Map keyed by whatever the callback returns.new Set()Creates a collection that stores each value only once, optionally filled from any iterable.Set.prototype.add()Inserts a value if it is not already present, and returns the same collection so calls can chain.Set.prototype.has()Tests whether a value is in the collection, in time that stays sublinear as it grows.Set.prototype.delete()Removes a value and reports whether it was actually there to remove.Set.prototype.clear()Removes every element at once, leaving the same object empty and reusable.Set.prototype.sizeReports how many unique values the collection currently holds, as a read-only count.Set.prototype.values()Returns an iterator that yields every value in insertion order, one at a time.Set.prototype.entries()Returns an iterator yielding a [value, value] pair for each element, mirroring the Map API.Set.prototype.forEach()Runs a callback once per element in insertion order, with no return value.Set.prototype.union()Returns a new collection holding every value from either this one or another set-like object.Set.prototype.intersection()Returns a new collection holding only the values present in both this one and another set-like object.Set.prototype.difference()Returns a new collection of the values in this one that are absent from another set-like object.Set.prototype.symmetricDifference()Returns a new Set of the elements that are in one set or the other, but not in both.Set.prototype.isSubsetOf()Returns true if every element of this set is also present in the given set.Set.prototype.isSupersetOf()Returns true if this set contains every element of the given set.Set.prototype.isDisjointFrom()Returns true if this set shares no elements at all with the given set.WeakMapStores key/value pairs whose object keys do not stop those objects from being garbage collected.WeakSetCollects objects for membership tests without preventing them from being garbage collected.WeakRefHolds a reference to an object without preventing that object from being garbage collected.
RegExp14
new RegExp()Builds a regular expression object from a pattern string or another regex, with optional flags.RegExp.prototype.test()Returns true when the regular expression finds a match anywhere in the given string.RegExp.prototype.exec()Searches a string and returns an array of the match and its capture groups, or null.RegExp.prototype.sourceReturns the pattern text of a regular expression without the enclosing slashes or flags.RegExp.prototype.flagsReturns the regex's flags as a single string in canonical order.RegExp.prototype.lastIndexHolds the index where the next match attempt starts for a global or sticky regex.RegExp.prototype.globalReturns whether the regular expression was created with the g flag.RegExp.prototype.ignoreCaseReturns whether the regular expression was created with the i flag.RegExp.prototype.multilineReturns whether the regular expression was created with the m flag.RegExp.prototype.stickyReturns whether the regular expression was created with the y flag.RegExp.prototype.dotAllReturns whether the regular expression was created with the s flag.RegExp.prototype.unicodeReturns whether the regular expression was created with the u flag.RegExp.prototype.toString()Returns a regular expression as a parsable literal string in the form /source/flags.RegExp.escape()Escapes a string so it can be embedded in a regular expression as a literal pattern.
Function & this11
Function.prototype.call()Calls a function with an explicit this value and arguments supplied individually.Function.prototype.apply()Calls a function with a given this value and arguments taken from an array or array-like.Function.prototype.bind()Creates a new function with this permanently fixed and any leading arguments pre-filled.Function.prototype.lengthReports how many parameters a function declares before its first default or rest parameter.Function.prototype.nameReturns the function's name, inferred from its declaration or assignment position.Function.prototype.prototypeHolds the object that becomes the prototype of every instance the function constructs with new.argumentsExposes every argument passed to a non-arrow function as an array-like object.Function.prototype.toString()Returns the exact source text of a function, or a native code stub for built-ins.new Function()Compiles a function from strings at runtime, always in global scope rather than a closure.Arrow functionsDefines a compact function expression that inherits this from the scope where it is written.thisRefers to the context of the current call, determined by how the function was invoked.
Symbol & Iterator25
Symbol()Creates a unique primitive value usable as a collision-free property key.Symbol.for()Returns the shared symbol registered under a string key, creating it on first use.Symbol.keyFor()Returns the global registry key for a symbol, or undefined if it was never registered.Symbol.prototype.descriptionReads the debug label a symbol was created with, without the Symbol(...) wrapper text.Symbol.prototype.toString()Formats a symbol as the string "Symbol(description)" for logging and debugging.Symbol.iteratorMarks the method that makes an object work with for...of, spread and destructuring.Symbol.asyncIteratorMarks the method that makes an object usable with for await...of.Symbol.hasInstanceOverrides what instanceof reports for a constructor or namespace object.Symbol.toPrimitiveControls the value an object produces under number, string and default coercion.Symbol.toStringTagSets the label Object.prototype.toString() reports for an object.Symbol.disposeMarks the cleanup method that a using declaration calls when a variable leaves scope.Symbol.asyncDisposeMarks the async cleanup method that an await using declaration awaits at scope exit.Iterator.from()Wrap any iterable or bare iterator object in a real Iterator so the helper methods become available.Iterator.prototype.map()Transform each value of an iterator lazily, producing a new iterator of the callback's results.Iterator.prototype.filter()Yield only the values of an iterator for which a callback returns truthy, lazily and on demand.Iterator.prototype.take()Limit an iterator to its first n values, making infinite sequences safe to consume.Iterator.prototype.drop()Skip the first n values of an iterator and yield everything after them.Iterator.prototype.flatMap()Map each value to an iterable and yield the inner values inline, flattening one level lazily.Iterator.prototype.reduce()Fold an iterator down to a single value by running a reducer over every element.Iterator.prototype.toArray()Collect every remaining value of an iterator into a new array.Iterator.prototype.forEach()Run a callback for every value of an iterator and return undefined.Iterator.prototype.some()Test whether at least one value of an iterator passes a callback, stopping at the first match.function*Define a function that returns a generator, pausing and resuming its body at each yield.Generator.prototype.next()Resume a generator until its next yield and return a { value, done } result object.yieldPauses a generator, hands a value to the caller, and resumes with whatever next() sends back in.
Global Functions & Timers19
parseInt()Parses a string into an integer in a given base, stopping at the first invalid character.parseFloat()Parses a string into a floating-point number, reading as far as the numeric syntax allows.isNaN()Tests whether a value becomes NaN after being coerced to a number.isFinite()Tests whether a value is a finite number after being coerced to a number.encodeURIComponent()Percent-encodes a string so it is safe to use as a single URL path segment or query value.decodeURIComponent()Decodes every percent-escape in a string back to the characters it represents.encodeURI()Percent-encodes a complete URL while leaving the characters that give it structure intact.decodeURI()Decodes a complete URL's percent-escapes while leaving reserved delimiters encoded.structuredClone()Creates a deep copy of a value, preserving Map, Set, Date, typed arrays and circular references.globalThisRefers to the global object in any JavaScript environment, without environment sniffing.eval()Executes a string as JavaScript code and returns its completion value.InfinityRepresents positive infinity, the value arithmetic overflow and division by zero produce.NaNRepresents the IEEE 754 Not-a-Number value, the only value that compares unequal to itself.undefinedHolds the primitive value given to unassigned variables, missing properties and empty returns.setTimeout()Runs a function once after a minimum delay and returns an ID you can pass to clearTimeout().clearTimeout()Cancels a pending timeout created by setTimeout() so its callback never runs.setInterval()Runs a function repeatedly at a fixed minimum interval until you cancel it with clearInterval().clearInterval()Stops a repeating timer started by setInterval() so its callback no longer runs.queueMicrotask()Schedules a callback to run at the end of the current task, before any timer or rendering.
All JavaScript reference pages A–Z
A
Array.prototype.map()Array.prototype.filter()Array.prototype.reduce()Array.prototype.reduceRight()Array.prototype.forEach()Array.prototype.find()Array.prototype.findIndex()Array.prototype.findLast()Array.prototype.findLastIndex()Array.prototype.includes()Array.prototype.indexOf()Array.prototype.lastIndexOf()Array.prototype.some()Array.prototype.every()Array.prototype.slice()Array.prototype.splice()Array.prototype.concat()Array.prototype.join()Array.prototype.push()Array.prototype.pop()Array.prototype.shift()Array.prototype.unshift()Array.prototype.sort()Array.prototype.reverse()Array.prototype.flat()Array.prototype.flatMap()Array.prototype.fill()Array.prototype.at()Array.prototype.with()Array.prototype.toSorted()Array.prototype.toReversed()Array.prototype.toSpliced()Array.prototype.keys()Array.prototype.values()Array.prototype.entries()Array.prototype.lengthArray.from()Array.of()Array.isArray()async functionawaitargumentsArrow functions
D
Date.now()Date.parse()Date.UTC()Date.prototype.getFullYear()Date.prototype.getMonth()Date.prototype.getDate()Date.prototype.getDay()Date.prototype.getHours()Date.prototype.getMinutes()Date.prototype.getSeconds()Date.prototype.getMilliseconds()Date.prototype.getTime()Date.prototype.getTimezoneOffset()Date.prototype.getUTCFullYear()Date.prototype.getUTCMonth()Date.prototype.getUTCDate()Date.prototype.setFullYear()Date.prototype.setMonth()Date.prototype.setDate()Date.prototype.setHours()Date.prototype.setMinutes()Date.prototype.setSeconds()Date.prototype.setTime()Date.prototype.toISOString()Date.prototype.toJSON()Date.prototype.toString()Date.prototype.toDateString()Date.prototype.toUTCString()Date.prototype.toLocaleDateString()Date.prototype.toLocaleString()Date.prototype.valueOf()decodeURIComponent()decodeURI()
F
I
M
Math.abs()Math.ceil()Math.floor()Math.round()Math.trunc()Math.max()Math.min()Math.pow()Math.sqrt()Math.cbrt()Math.random()Math.sign()Math.hypot()Math.exp()Math.log()Math.log2()Math.log10()Math.sin()Math.cos()Math.tan()Math.asin()Math.acos()Math.atan()Math.atan2()Math.PIMath.EMath.SQRT2Math.LN2Math.LN10Map.prototype.set()Map.prototype.get()Map.prototype.has()Map.prototype.delete()Map.prototype.clear()Map.prototype.sizeMap.prototype.keys()Map.prototype.values()Map.prototype.entries()Map.prototype.forEach()Map.groupBy()
N
Number.prototype.toFixed()Number.prototype.toPrecision()Number.prototype.toExponential()Number.prototype.toString()Number.prototype.toLocaleString()Number.isInteger()Number.isFinite()Number.isNaN()Number.isSafeInteger()Number.parseInt()Number.parseFloat()Number.EPSILONNumber.MAX_SAFE_INTEGERNumber.MIN_SAFE_INTEGERNumber.MAX_VALUENumber.MIN_VALUENumber.POSITIVE_INFINITYNumber.NEGATIVE_INFINITYNumber.NaNnew Date()new Promise()new Map()new Set()new RegExp()new Function()NaN
O
Object.keys()Object.values()Object.entries()Object.fromEntries()Object.assign()Object.create()Object.freeze()Object.isFrozen()Object.seal()Object.isSealed()Object.preventExtensions()Object.isExtensible()Object.defineProperty()Object.getOwnPropertyDescriptor()Object.getOwnPropertyNames()Object.getPrototypeOf()Object.setPrototypeOf()Object.is()Object.hasOwn()Object.groupBy()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.toString()
P
R
RegExp.prototype.test()RegExp.prototype.exec()RegExp.prototype.sourceRegExp.prototype.flagsRegExp.prototype.lastIndexRegExp.prototype.globalRegExp.prototype.ignoreCaseRegExp.prototype.multilineRegExp.prototype.stickyRegExp.prototype.dotAllRegExp.prototype.unicodeRegExp.prototype.toString()RegExp.escape()
S
String.prototype.lengthString.prototype.at()String.prototype.charAt()String.prototype.charCodeAt()String.prototype.codePointAt()String.prototype.concat()String.prototype.includes()String.prototype.indexOf()String.prototype.lastIndexOf()String.prototype.startsWith()String.prototype.endsWith()String.prototype.slice()String.prototype.substring()String.prototype.substr()String.prototype.split()String.prototype.replace()String.prototype.replaceAll()String.prototype.match()String.prototype.matchAll()String.prototype.search()String.prototype.trim()String.prototype.trimStart()String.prototype.trimEnd()String.prototype.padStart()String.prototype.padEnd()String.prototype.repeat()String.prototype.toLowerCase()String.prototype.toUpperCase()String.prototype.normalize()String.prototype.localeCompare()String.prototype.toString()String.fromCharCode()String.fromCodePoint()String.raw()Set.prototype.add()Set.prototype.has()Set.prototype.delete()Set.prototype.clear()Set.prototype.sizeSet.prototype.values()Set.prototype.entries()Set.prototype.forEach()Set.prototype.union()Set.prototype.intersection()Set.prototype.difference()Set.prototype.symmetricDifference()Set.prototype.isSubsetOf()Set.prototype.isSupersetOf()Set.prototype.isDisjointFrom()Symbol()Symbol.for()Symbol.keyFor()Symbol.prototype.descriptionSymbol.prototype.toString()Symbol.iteratorSymbol.asyncIteratorSymbol.hasInstanceSymbol.toPrimitiveSymbol.toStringTagSymbol.disposeSymbol.asyncDisposestructuredClone()setTimeout()setInterval()