This time I don't have any problem but just for curiosity I want to know how many exception are there in JavaScript.
For example I am using following code:
<script type="text/javascript">
var x;
try{
x = 1 / 0;
alert(x); // output: Infinity. FYI: JavaScript has Infinity property and it's value is 1.7976931348623157E+10308
alert(funCreate());
}
catch(obj)
{
alert(obj.fileName);
alert(obj.lineNumber);
alert(obj.message); // output: funCreate is not defined
alert(obj.name); // output: ReferenceError
alert(obj.stack);
};
</script>
here, ReferenceError is like an exception type. So if it is treated as an exception type, then can we handle the exception by type? like we all do in other programming language. see link.
Thanks...
alert(1.7976931348623157e+309)
. It shouldn't be surprising. How do you express actual Infinity in double-precision floating point number? Well, you can't. What do you show when you run out of bits to express a number? As far as JS is concerned, any value beyond 1.7976931348623157e+308 is 'Infinity'. JS shouldn't be your first choice for numerical accuracy.for(i=0;i<=Infinity; i++){}
JavaScript has Infinity property and it's value is 1.7976931348623157E+10308
quoted from OP's comment. In IEEE 754 "Infinity" itself already is a special value, it has no decimal representations.