SOLFIND
Web Lens
Portal home

JavaScript reference - JavaScript | MDN

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference • 225 KB fetched
Open original page


JavaScript reference - JavaScript | MDN * Skip to main content * Skip to search HTML HTML: Markup language HTML reference * Elements * Global attributes * Attributes * See all… HTML guides * Responsive images * HTML cheatsheet * Date & time formats * See all… Markup languages * SVG * MathML * XML CSS CSS: Styling language CSS reference * Properties * Selectors * At-rules * Values * See all… CSS guides * Box model * Animations * Flexbox * Colors * See all… Layout cookbook * Column layouts * Centering an element * Card component * See all… JavaScript JS JavaScript: Scripting language JS reference * Standard built-in objects * Expressions & operators * Statements & declarations * Functions * See all… JS guides * Control flow & error handing * Loops and iteration * Working with objects * Using classes * See all… Web APIs Web APIs: Programming interfaces Web API reference * File system API * Fetch API * Geolocation API * HTML DOM API * Push API * Service worker API * See all… Web API guides * Using the Web animation API * Using the Fetch API * Working with the History API * Using the Web speech API * Using web workers All All web technology Technologies * Accessibility * HTTP * URI * Web extensions * WebAssembly * WebDriver * See all… Topics * Media * Performance * Privacy * Security * Progressive web apps Learn Learn web development Frontend developer course * Getting started modules * Core modules * MDN Curriculum * Check out the video course from Scrimba, our partner Learn HTML * Structuring content with HTML module Learn CSS * CSS styling basics module * CSS layout module Learn JavaScript * Dynamic scripting with JavaScript module Tools Discover our tools * Playground * HTTP Observatory * Border-image generator * Border-radius generator * Box-shadow generator * Color format converter * Color mixer * Shape generator About Get to know MDN better * About MDN * Advertise with us * Community * MDN on GitHub Blog Toggle sidebar * Web * JavaScript * Reference Theme * OS default * Light * Dark English (US) Remember language Learn more * Deutsch * English (US) * Español * Français * 日本語 * 한국어 * Português (do Brasil) * Русский * 中文 (简体) * 正體中文 (繁體) JavaScript reference The JavaScript reference serves as a repository of facts about the JavaScript language. The entire language is described here in detail. As you write JavaScript code, you'll refer to these pages often (thus the title "JavaScript reference"). The JavaScript language is intended to be used within some larger environment, be it a browser, server-side scripts, or similar. For the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. If you are new to JavaScript, start with the guide . Once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs. In this article * Built-ins * Statements * Expressions and operators * Functions * Classes * Regular expressions * Additional reference pages Built-ins JavaScript standard built-in objects , along with their methods and properties. Value properties * globalThis * Infinity * NaN * undefined Function properties * eval() * isFinite() * isNaN() * parseFloat() * parseInt() * decodeURI() * decodeURIComponent() * encodeURI() * encodeURIComponent() * escape() * unescape() Fundamental objects * Object * Function * Boolean * Symbol Error objects * Error * AggregateError * EvalError * RangeError * ReferenceError * SuppressedError * SyntaxError * TypeError * URIError * InternalError Numbers and dates * Number * BigInt * Math * Date * Temporal Text processing * String * RegExp Indexed collections * Array * Int8Array * Uint8Array * Uint8ClampedArray * Int16Array * Uint16Array * Int32Array * Uint32Array * BigInt64Array * BigUint64Array * Float16Array * Float32Array * Float64Array Keyed collections * Map * Set * WeakMap * WeakSet Structured data * ArrayBuffer * SharedArrayBuffer * DataView * Atomics * JSON Managing memory * WeakRef * FinalizationRegistry Control abstraction objects * Iterator * AsyncIterator * Promise * GeneratorFunction * AsyncGeneratorFunction * Generator * AsyncGenerator * AsyncFunction * DisposableStack * AsyncDisposableStack Reflection * AbstractModuleSource * Reflect * Proxy Internationalization * Intl * Intl.Collator * Intl.DateTimeFormat * Intl.DisplayNames * Intl.DurationFormat * Intl.ListFormat * Intl.Locale * Intl.NumberFormat * Intl.PluralRules * Intl.RelativeTimeFormat * Intl.Segmenter Statements JavaScript statements and declarations Control flow * return * break * continue * throw * if...else * switch * try...catch Declaring variables * var * let * const * using * await using Functions and classes * function * function* * async function * async function* * class Iterations * do...while * for * for...in * for...of * for await...of * while Others * Empty * Block * Expression statement * debugger * export * import * import source * label * with Expressions and operators JavaScript expressions and operators . Primary expressions * this * Literals * [] * {} * function * class * function* * async function * async function* * /ab+c/i * `string` * ( ) Left-hand-side expressions * Property accessors * ?. * new * new.target * import.meta * super * import() * import.source() Increment and decrement * A++ * A-- * ++A * --A Unary operators * delete * void * typeof * + * - * ~ * ! * await Arithmetic operators * ** * * * / * % * + (Plus) * - Relational operators * < (Less than) * > (Greater than) * <= * >= * instanceof * in Equality operators * == * != * === * !== Bitwise shift operators * << * >> * >>> Binary bitwise operators * & * | * ^ Binary logical operators * && * || * ?? Conditional (ternary) operator * (condition ? ifTrue : ifFalse) Assignment operators * = * *= * /= * %= * += * -= * <<= * >>= * >>>= * &= * ^= * |= * **= * &&= * ||= * ??= * [a, b] = arr , { a, b } = obj Yield operators * yield * yield* Spread syntax * ...obj Comma operator * , Functions JavaScript functions. * Arrow Functions * Default parameters * Rest parameters * arguments * Method definitions * getter * setter Classes JavaScript classes. * constructor * extends * Private elements * Public class fields * static * Static initialization blocks Regular expressions JavaScript regular expressions. * Backreference: \1 , \2 * Capturing group: (...) * Character class: [...] , [^...] * Character class escape: \d , \D , \w , \W , \s , \S * Character escape: \n , \u{...} * Disjunction: | * Input boundary assertion: ^ , $ * Literal character: a , b * Lookahead assertion: (?=...) , (?!...) * Lookbehind assertion: (?<=...) , (?<!...) * Modifier: (?ims-ims:...) * Named backreference: \k<name> * Named capturing group: (?<name>...) * Non-capturing group: (?:...) * Quantifier: * , + , ? , {n} , {n,} , {n,m} * Unicode character class escape: \p{...} , \P{...} * Wildcard: . * Word boundary assertion: \b , \B Additional reference pages * JavaScript technologies overview * Execution model * Lexical grammar * Data types and data structures * Iteration protocols * Trailing commas * Errors * Strict mode * Deprecated features Help improve MDN Yes No Learn how to contribute This page was last modified on Sep 11, 2026 by MDN contributors . View this page on GitHub • Report a problem with this content Clear filter input * JavaScript * Tutorials and guides * JavaScript Guide * Introduction * Grammar and types * Control flow and error handling * Loops and iteration * Functions * Expressions and operators * Numbers and strings * Representing dates & times * Regular expressions * Indexed collections * Keyed collections * Working with objects * Using classes * Using promises * JavaScript typed arrays * Iterators and generators * Resource management * Internationalization * JavaScript modules * Intermediate * Language overview * JavaScript data structures * Equality comparisons and sameness * Enumerability and ownership of properties * Closures * Advanced * Inheritance and the prototype chain * Meta programming * Memory Management * References * Built-in objects * AbstractModuleSource * AggregateError * Array * ArrayBuffer * AsyncDisposableStack * AsyncFunction * AsyncGenerator * AsyncGeneratorFunction * AsyncIterator * Atomics * BigInt * BigInt64Array * BigUint64Array * Boolean * DataView * Date * decodeURI() * decodeURIComponent() * DisposableStack * encodeURI() * encodeURIComponent() * Error * escape() * eval() * EvalError * FinalizationRegistry * Float16Array * Float32Array * Float64Array * Function * Generator * GeneratorFunction * globalThis * Infinity * Int8Array * Int16Array * Int32Array * InternalError * Intl * isFinite() * isNaN() * Iterator * JSON * Map * Math * NaN * Number * Object * parseFloat() * parseInt() * Promise * Proxy * RangeError * ReferenceError * Reflect * RegExp * Set * SharedArrayBuffer * String * SuppressedError * Symbol * SyntaxError * Temporal * TypedArray * TypeError * Uint8Array * Uint8ClampedArray * Uint16Array * Uint32Array * undefined * unescape() * URIError * WeakMap * WeakRef * WeakSet * Expressions & operators * Addition (+) * Addition assignment (+=) * Assignment (=) * async function expression * async function* expression * await * Bitwise AND (&) * Bitwise AND assignment (&=) * Bitwise NOT (~) * Bitwise OR (|) * Bitwise OR assignment (|=) * Bitwise XOR (^) * Bitwise XOR assignment (^=) * class expression * Comma operator (,) * Conditional (ternary) operator * Decrement (--) * delete * Destructuring * Division (/) * Division assignment (/=) * Equality (==) * Exponentiation (**) * Exponentiation assignment (**=) * function expression * function* expression * Greater than (>) * Greater than or equal (>=) * Grouping operator ( ) * import.meta * import.meta.resolve() * import() * import.source() * in * Increment (++) * Inequality (!=) * instanceof * Left shift (<<) * Left shift assignment (<<=) * Less than (<) * Less than or equal (<=) * Logical AND (&&) * Logical AND assignment (&&=) * Logical NOT (!) * Logical OR (||) * Logical OR assignment (||=) * Multiplication (*) * Multiplication assignment (*=) * new * new.target * null * Nullish coalescing assignment (??=) * Nullish coalescing operator (??) * Object initializer * Operator precedence * Optional chaining (?.) * Property accessors * Remainder (%) * Remainder assignment (%=) * Right shift (>>) * Right shift assignment (>>=) * Spread syntax (...) * Strict equality (===) * Strict inequality (!==) * Subtraction (-) * Subtraction assignment (-=) * super * this * typeof * Unary negation (-) * Unary plus (+) * Unsigned right shift (>>>) * Unsigned right shift assignment (>>>=) * void operator * yield * yield* * Statements & declarations * async function * async function* * await using * Block statement * break * class * const * continue * debugger * do...while * Empty statement * export * Expression statement * for * for await...of * for...in * for...of * function * function* * if...else * import * Import attributes * import source * Labeled statement * let * return * switch * throw * try...catch * using * var * while * with * Functions * Arrow function expressions * Default parameters * get * Method definitions * Rest parameters * set * The arguments object * [Symbol.iterator]() * callee * length * Classes * constructor * extends * Private elements * Public class fields * static * Static initialization blocks * Regular expressions * Backreference: \1, \2 * Buffer boundary assertion: \A, \z, \Z * Capturing group: (...) * Character class escape: \d, \D, \w, \W, \s, \S * Character class: [...], [^...] * Character escape: \n, \u{...} * Disjunction: | * Input boundary assertion: ^, $ * Literal character: a, b * Lookahead assertion: (?=...), (?!...) * Lookbehind assertion: (?<=...), (?<!...) * Modifier: (?ims-ims:...) * Named backreference: \k<name> * Named capturing group: (?<name>...) * Non-capturing group: (?:...) * Quantifier: *, +, ?, {n}, {n,}, {n,m} * Unicode character class escape: \p{...}, \P{...} * Wildcard: . * Word boundary assertion: \b, \B * Errors * AggregateError: No Promise in Promise.any was resolved * Error: Permission denied to access property "x" * InternalError: too much recursion * RangeError: argument is not a valid code point * RangeError: BigInt division by zero * RangeError: BigInt negative exponent * RangeError: form must be one of 'NFC', 'NFD', 'NFKC', or 'NFKD' * RangeError: invalid array length * RangeError: invalid date * RangeError: precision is out of range * RangeError: radix must be an integer * RangeError: repeat count must be less than infinity * RangeError: repeat count must be non-negative * RangeError: x can't be converted to BigInt because it isn't an integer * ReferenceError: "x" is not defined * ReferenceError: assignment to undeclared variable "x" * ReferenceError: can't access lexical declaration 'X' before initialization * ReferenceError: must call super constructor before using 'this' in derived class constructor * ReferenceError: super() called twice in derived class constructor * SyntaxError: 'arguments'/'eval' can't be defined or assigned to in strict mode code * SyntaxError: "0"-prefixed octal literals are deprecated * SyntaxError: "use strict" not allowed in function with non-simple parameters * SyntaxError: "x" is a reserved identifier * SyntaxError: \ at end of pattern * SyntaxError: a declaration in the head of a for-of loop can't have an initializer * SyntaxError: applying the 'delete' operator to an unqualified name is deprecated * SyntaxError: arguments is not valid in fields * SyntaxError: await is only valid in async functions, async generators and modules * SyntaxError: await/yield expression can't be used in parameter * SyntaxError: cannot use ?? unparenthesized within || and && expressions * SyntaxError: character class escape cannot be used in class range in regular expression * SyntaxError: continue must be inside loop * SyntaxError: duplicate capture group name in regular expression * SyntaxError: duplicate formal argument x * SyntaxError: for-in loop head declarations may not have initializers * SyntaxError: function statement requires a name * SyntaxError: functions cannot be labelled * SyntaxError: getter and setter for private name #x should either be both static or non-static * SyntaxError: getter functions must have no arguments * SyntaxError: identifier starts immediately after numeric literal * SyntaxError: illegal character * SyntaxError: import declarations may only appear at top level of a module * SyntaxError: incomplete quantifier in regular expression * SyntaxError: invalid assignment left-hand side * SyntaxError: invalid BigInt syntax * SyntaxError: invalid capture group name in regular expression * SyntaxError: invalid character in class in regular expression * SyntaxError: invalid class set operation in regular expression * SyntaxError: invalid decimal escape in regular expression * SyntaxError: invalid identity escape in regular expression * SyntaxError: invalid named capture reference in regular expression * SyntaxError: invalid property name in regular expression * SyntaxError: invalid range in character class * SyntaxError: invalid regexp group * SyntaxError: invalid regular expression flag "x" * SyntaxError: invalid unicode escape in regular expression * SyntaxError: JSON.parse: bad parsing * SyntaxError: label not found * SyntaxError: missing : after property id * SyntaxError: missing ) after argument list * SyntaxError: missing ) after condition * SyntaxError: missing ] after element list * SyntaxError: missing } after function body * SyntaxError: missing } after property list * SyntaxError: missing = in const declaration * SyntaxError: missing formal parameter * SyntaxError: missing name after . operator * SyntaxError: missing variable name * SyntaxError: negated character class with strings in regular expression * SyntaxError: new keyword cannot be used with an optional chain * SyntaxError: nothing to repeat * SyntaxError: numbers out of order in {} quantifier. * SyntaxError: octal escape sequences can't be used in untagged template literals or in strict mode code * SyntaxError: parameter after rest parameter * SyntaxError: private fields can't be deleted * SyntaxError: property name __proto__ appears more than once in object literal * SyntaxError: raw bracket is not allowed in regular expression with unicode flag * SyntaxError: redeclaration of formal parameter "x" * SyntaxError: reference to undeclared private field or method #x * SyntaxError: rest parameter may not have a default * SyntaxError: return not in function * SyntaxError: setter functions must have one argument * SyntaxError: string literal contains an unescaped line break * SyntaxError: super() is only valid in derived class constructors * SyntaxError: tagged template cannot be used with optional chain * SyntaxError: Unexpected '#' used outside of class body * SyntaxError: Unexpected token * SyntaxError: unlabeled break must be inside loop or switch * SyntaxError: unparenthesized unary expression can't appear on the left-hand side of '**' * SyntaxError: use of super property/member accesses only valid within methods or eval code within methods * SyntaxError: Using //@ to indicate sourceURL pra

Links found on this page

  1. Skip to main content [direct]
  2. HTML: Markup language [direct]
  3. Elements [direct]
  4. Global attributes [direct]
  5. Attributes [direct]
  6. See all… [direct]
  7. Responsive images [direct]
  8. HTML cheatsheet [direct]
  9. Date & time formats [direct]
  10. See all… [direct]
  11. SVG [direct]
  12. MathML [direct]
  13. XML [direct]
  14. CSS: Styling language [direct]
  15. Properties [direct]
  16. Selectors [direct]
  17. At-rules [direct]
  18. Values [direct]
  19. See all… [direct]
  20. Box model [direct]
  21. Animations [direct]
  22. Flexbox [direct]
  23. Colors [direct]
  24. See all… [direct]
  25. Column layouts [direct]
  26. Centering an element [direct]
  27. Card component [direct]
  28. See all… [direct]
  29. JavaScript: Scripting language [direct]
  30. Standard built-in objects [direct]
  31. Expressions & operators [direct]
  32. Statements & declarations [direct]
  33. Functions [direct]
  34. Control flow & error handing [direct]
  35. Loops and iteration [direct]
  36. Working with objects [direct]
  37. Using classes [direct]
  38. See all… [direct]
  39. Web APIs: Programming interfaces [direct]
  40. File system API [direct]
  41. Fetch API [direct]
  42. Geolocation API [direct]
  43. HTML DOM API [direct]
  44. Push API [direct]
  45. Service worker API [direct]
  46. Using the Web animation API [direct]
  47. Using the Fetch API [direct]
  48. Working with the History API [direct]
  49. Using the Web speech API [direct]
  50. Using web workers [direct]
  51. All web technology [direct]
  52. Accessibility [direct]
  53. HTTP [direct]
  54. URI [direct]
  55. Web extensions [direct]
  56. WebAssembly [direct]
  57. WebDriver [direct]
  58. Media [direct]
  59. Performance [direct]
  60. Privacy [direct]
  61. Security [direct]
  62. Progressive web apps [direct]
  63. Learn web development [direct]
  64. Getting started modules [direct]
  65. Core modules [direct]
  66. MDN Curriculum [direct]
  67. Check out the video course from Scrimba, our partner [direct]
  68. Structuring content with HTML module [direct]
  69. CSS styling basics module [direct]
  70. CSS layout module [direct]
  71. Dynamic scripting with JavaScript module [direct]
  72. Playground [direct]
  73. HTTP Observatory [direct]
  74. Border-image generator [direct]
  75. Border-radius generator [direct]
  76. Box-shadow generator [direct]
  77. Color format converter [direct]
  78. Color mixer [direct]
  79. Shape generator [direct]
  80. About MDN [direct]