--- title: EvalError slug: Web/JavaScript/Reference/Global_Objects/EvalError tags: - Error - EvalError - JavaScript - Reference translation_of: Web/JavaScript/Reference/Global_Objects/EvalError ---
EvalError 객체는 전역 {{jsxref("Global_Objects/eval", "eval()")}} 함수에 관한 오류를 나타냅니다. 이 예외는 JavaScript에 의해 더 이상 발생하지 않지만 EvalError 객체는 하위 호환성을 위해 남아있습니다.
new EvalError([message[, fileName[, lineNumber]]])
message {{optional_inline}}fileName {{optional_inline}} {{non-standard_inline}}lineNumber {{optional_inline}} {{non-standard_inline}}전역 EvalError에는 자체 메서드가 없지만 프로토 타입 체인을 통해 일부 메서드를 상속받습니다.
EvalError 인스턴스EvalError는 현재 ECMAScript 사양에서 사용되지 않으므로 런타임에 의해 throw되지 않습니다. 그러나 개체 자체는 이전 버전의 사양과의 하위 호환성을 유지합니다.
EvalErrortry {
throw new EvalError('Hello', 'someFile.js', 10);
} catch (e) {
console.log(e instanceof EvalError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "EvalError"
console.log(e.fileName); // "someFile.js"
console.log(e.lineNumber); // 10
console.log(e.columnNumber); // 0
console.log(e.stack); // "@Scratchpad/2:2:9\n"
}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('ES3')}} | {{Spec2('ES3')}} | Initial definition. |
| {{SpecName('ES5.1', '#sec-15.11.6.1', 'EvalError')}} | {{Spec2('ES5.1')}} | Not used in this specification. Present for backward compatibility. |
| {{SpecName('ES6', '#sec-native-error-types-used-in-this-standard-evalerror', 'EvalError')}} | {{Spec2('ES6')}} | Not used in this specification. Present for backward compatibility. |
| {{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-evalerror', 'EvalError')}} | {{Spec2('ESDraft')}} |