| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/RangeError | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
* Some parts of this feature may have varying levels of support.
RangeError .
RangeError .
.
String.prototype.normalize() ,Array ,Number.prototype.toExponential(), Number.prototype.toFixed() Number.prototype.toPrecision() .RangeError , structuredClone() postMessage() Worker .
RangeError Error .
RangeError() RangeError .
Error .
RangeError.prototype RangeError .
RangeError.prototype.constructor . RangeError
RangeError .
RangeError.prototype.name . RangeError.prototype.name "RangeError".
Error .
function check(n) {
if (!(n >= -500 && n <= 500)) {
throw new RangeError("The argument must be between -500 and 500.");
}
}
try {
check(2000);
} catch (error) {
if (error instanceof RangeError) {
//
}
}
function check(value) {
if (!["apple", "banana", "carrot"].includes(value)) {
throw new RangeError(
'The argument must be an "apple", "banana", or "carrot".',
);
}
}
try {
check("cabbage");
} catch (error) {
if (error instanceof RangeError) {
//
}
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-native-error-types-used-in-this-standard-rangeerror |
ErrorArrayNumber.prototype.toExponential()Number.prototype.toFixed()Number.prototype.toPrecision()String.prototype.normalize()This page was last modified on 2024 7 7 by MDN contributors.
RangeErrorErrorObject/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()AggregateErrorEvalErrorInternalErrorReferenceErrorSyntaxErrorTypeErrorURIErrorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |