This page was translated from English by the community.Learn more and join the MDN Web Docs community.
EvalError
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
* Some parts of this feature may have varying levels of support.
EvalError 객체는 전역eval() 함수에 관한 오류를 나타냅니다. 이 예외는 JavaScript에 의해 더 이상 발생하지 않지만EvalError 객체는 하위 호환성을 위해 남아있습니다.
EvalError는직렬화 가능한 객체이기에structuredClone()로 복제 혹은Workers간에postMessage()를 사용하여 복사가 가능합니다.
EvalError는Error의 하위 클래스입니다.
In this article
생성자
EvalError()새로운
EvalError객체를 생성합니다.
인스턴스 속성
인스턴스 속성은 부모인Error로부터 상속받습니다.
아래 속성은EvalError.prototype에 정의되어 있으며 모든EvalError 인스턴스와 공유합니다.
EvalError.prototype.constructor인스턴스 객체를 생성하는 생성자 함수입니다.
EvalError인스턴스에서 초기 값은EvalError생성자입니다.EvalError.prototype.name오류의 유형에 대한 이름을 나타냅니다.
EvalError.prototype.name의 초기 값은"EvalError"입니다.
인스턴스 메서드
인스턴스 메서드는 부모인Error로부터 상속받습니다.
예제
>EvalError 생성하기
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}명세서
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-native-error-types-used-in-this-standard-evalerror> |