JavaScript Error name Property - RangeError, A number "out of range" has occurred - Javascript DOM

Javascript examples for DOM:Error

Description

JavaScript Error name Property - RangeError, A number "out of range" has occurred

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>You cannot set the number of significant digits of a number to 500:</p>

<p id="demo">

<script>
var num = 1;//from w  w w .ja v a 2 s . c  om
try {
    num.toPrecision(500);
}
catch(err) {
    document.getElementById("demo").innerHTML = err.name;
}
</script>

</body>
</html>

Related Tutorials