---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# ReferenceError

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

## Syntax

```js
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.
