RangeError

If a value is given and the value given is above the specific range RangeError is thrown
Compiler will stops execution of rest of code

To solve this we need to use try catch block

Ex: 100 is not fit
100 digits will not be allowed here

let num = 1;
try {
  num.toPrecision(100);  
}
catch(err) {
  document.getElementById("demo").innerHTML = err.name;
}

Leave a comment

Your email address will not be published. Required fields are marked *