Standard built-ins

ReferenceError()

Try the free JavaScript compiler

Indicates an unresolvable reference or access to an uninitialized binding. Creating it does not throw automatically.

Formal Syntax & Structure

javascript syntaxjavascript
new ReferenceError([message], [options])

Parameters & Attributes

NameTypeDescription
messageStringDiagnostic text.
optionsObjectOptional cause property.

Return Value

ReferenceError

Error subtype instance.

Working Example

Example Snippetjavascript
console.log(new ReferenceError("example").name);
JavaScript Reference