Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

EvalError

BaselineWidely available *

TheEvalError object indicates an error regarding the globaleval() function. This exception is not thrown by JavaScript anymore, however theEvalError object remains for compatibility.

EvalError is aserializable object, so it can be cloned withstructuredClone() or copied betweenWorkers usingpostMessage().

EvalError is a subclass ofError.

Constructor

EvalError()

Creates a newEvalError object.

Instance properties

Also inherits instance properties from its parentError.

These properties are defined onEvalError.prototype and shared by allEvalError instances.

EvalError.prototype.constructor

The constructor function that created the instance object. ForEvalError instances, the initial value is theEvalError constructor.

EvalError.prototype.name

Represents the name for the type of error. ForEvalError.prototype.name, the initial value is"EvalError".

Instance methods

Inherits instance methods from its parentError.

Examples

Creating an EvalError

js
try {  throw new EvalError("Hello");} catch (e) {  console.log(e instanceof EvalError); // true  console.log(e.message); // "Hello"  console.log(e.name); // "EvalError"  console.log(e.stack); // Stack of the error}

Specifications

Specification
ECMAScript® 2026 Language Specification
# sec-native-error-types-used-in-this-standard-evalerror

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp