번역이 완료되지 않았습니다. Please help translate this article from English
RangeError 객체는 값이 집합에 없거나 허용되지 않은 값의 범위일 때 에러를 나타냅니다.
구문
new RangeError([message[, fileName[, lineNumber]]])
파라메터
message- 선택적 파라메터. 에러에 대한 설명.
fileName- 선택적 파라메터. 예외(exception)가 발생한 코드를 포함하고 있는 파일의 이름.
lineNumber- 선택적 파라메터. 예외(exception)가 발생한 코드의 라인 넘버.
설명
RangeError 는 허용되지 않은 범위의 수를 포함한 아규먼트를 함수에 넘기려고 할 때 던져집니다. Array 생성자로 허용범위를 초과한 길이의 배열 생성을 시도하려 하거나, 적절하지 않은 값을 numeric method(Number.toExponential(), Number.toFixed() 또는 Number.toPrecision())에 넘기려 할 때, 이 에러를 만날 수 있을 것입니다.
속성
RangeError.prototypeRangeError객체에 속성을 추가하도록 해준다.
메소드
전역(global)의 RangeError는 자신의 메소드를 가지고 있지 않습니다. 하지만, 몇 가지의 메소드를 프로토타입 체인을 통해 상속받습니다.
RangeError 인스턴스
속성
RangeError.prototype.constructor- Specifies the function that created an instance's prototype.
RangeError.prototype.message- Error message. Although ECMA-262 specifies that
RangeErrorshould provide its ownmessageproperty, in SpiderMonkey, it inheritsError.prototype.message. RangeError.prototype.name- Error name. Inherited from
Error. RangeError.prototype.fileName- Path to file that raised this error. Inherited from
Error. RangeError.prototype.lineNumber- Line number in file that raised this error. Inherited from
Error. RangeError.prototype.columnNumber- Column number in line that raised this error. Inherited from
Error. RangeError.prototype.stack- Stack trace. Inherited from
Error.
메소드
Although the RangeError prototype object does not contain any methods of its own, RangeError instances do inherit some methods through the prototype chain.
예
RangeError 사용하기
var check = function(num) {
if (num < MIN || num > MAX) {
throw new RangeError('Parameter must be between ' + MIN + ' and ' + MAX);
}
};
try {
check(500);
}
catch (e) {
if (e instanceof RangeError) {
// Handle range error
}
}
스펙
브라우저 호환성
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |