Skip to main content
Version: 3.27.2

ReferenceError

The ReferenceError object represents an error when a non-existent variable is referenced.

Syntax

new ReferenceError()
new ReferenceError(message)
new ReferenceError(message, options)
new ReferenceError(message, fileName)
new ReferenceError(message, fileName, lineNumber)

ReferenceError()
ReferenceError(message)
ReferenceError(message, options)
ReferenceError(message, fileName)
ReferenceError(message, fileName, lineNumber)

Note: ReferenceError() can be called with or without new. Both create a new ReferenceError instance.

Parameters

  • message optional
    • : Human-readable description of the error.
  • options optional
    • : An object that has the following properties:
      • cause optional
        • : A property indicating the specific cause of the error. When catching and re-throwing an error with a more-specific or useful error message, this property can be used to pass the original error.