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
- Skip to main content [direct]
- HTML: Markup language [direct]
- Elements [direct]
- Global attributes [direct]
- Attributes [direct]
- See all… [direct]
- Responsive images [direct]
- HTML cheatsheet [direct]
- Date & time formats [direct]
- See all… [direct]
- SVG [direct]
- MathML [direct]
- XML [direct]
- CSS: Styling language [direct]
- Properties [direct]
- Selectors [direct]
- At-rules [direct]
- Values [direct]
- See all… [direct]
- Box model [direct]
- Animations [direct]
- Flexbox [direct]
- Colors [direct]
- See all… [direct]
- Column layouts [direct]
- Centering an element [direct]
- Card component [direct]
- See all… [direct]
- JavaScript: Scripting language [direct]
- Standard built-in objects [direct]
- Expressions & operators [direct]
- Statements & declarations [direct]
- Functions [direct]
- Control flow & error handing [direct]
- Loops and iteration [direct]
- Working with objects [direct]
- Using classes [direct]
- See all… [direct]
- Web APIs: Programming interfaces [direct]
- File system API [direct]
- Fetch API [direct]
- Geolocation API [direct]
- HTML DOM API [direct]
- Push API [direct]
- Service worker API [direct]
- Using the Web animation API [direct]
- Using the Fetch API [direct]
- Working with the History API [direct]
- Using the Web speech API [direct]
- Using web workers [direct]
- All web technology [direct]
- Accessibility [direct]
- HTTP [direct]
- URI [direct]
- Web extensions [direct]
- WebAssembly [direct]
- WebDriver [direct]
- Media [direct]
- Performance [direct]
- Privacy [direct]
- Security [direct]
- Progressive web apps [direct]
- Learn web development [direct]
- Getting started modules [direct]
- Core modules [direct]
- MDN Curriculum [direct]
- Check out the video course from Scrimba, our partner [direct]
- Structuring content with HTML module [direct]
- CSS styling basics module [direct]
- CSS layout module [direct]
- Dynamic scripting with JavaScript module [direct]
- Playground [direct]
- HTTP Observatory [direct]
- Border-image generator [direct]
- Border-radius generator [direct]
- Box-shadow generator [direct]
- Color format converter [direct]
- Color mixer [direct]
- Shape generator [direct]
- About MDN [direct]