Standard built-ins

Error()

Try the free JavaScript compiler

Creates an Error object; it does not itself throw. Options can supply cause.

Formal Syntax & Structure

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

Parameters & Attributes

NameTypeDescription
messageStringDiagnostic message.
optionsObjectOptional cause property.

Return Value

Error

Error instance.

Working Example

Example Snippetjavascript
console.log(new Error("bad").message);
JavaScript Reference