[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError [Back]  [Original]

ReferenceError - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

ReferenceError

Baseline Widely available *

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

* Some parts of this feature may have varying levels of support.

ReferenceError , , ( ) .

ReferenceError , structuredClone() postMessage().

RangeReferenceErrorError Error.

In this article

ReferenceError()

ReferenceError.

Error.

ReferenceError.prototype ReferenceError.

ReferenceError.prototype.constructor

-, . ReferenceError ReferenceError.

ReferenceError.prototype.name

. ReferenceError.prototype.name "ReferenceError".

Error.

ReferenceError

js
try {
  let a = undefinedVariable;
} catch (e) {
  console.log(e instanceof ReferenceError); // true
  console.log(e.message); // "undefinedVariable is not defined"
  console.log(e.name); // "ReferenceError"
  console.log(e.stack); //  
}

ReferenceError

js
try {
  throw new ReferenceError("");
} catch (e) {
  console.log(e instanceof ReferenceError); // true
  console.log(e.message); // ""
  console.log(e.name); // "ReferenceError"
  console.log(e.stack); //  
}

Specification
ECMAScript 2027 LanguageSpecification
# sec-native-error-types-used-in-this-standard-referenceerror


Web Proxy Viewer  |  New URL  |  Original Page