Latest

recent

JavaScript Infinity Property

Definition and Usage

The Infinity property is a numeric value that represents positive or negative infinity.
Infinity is displayed when a number is higher than 1.7976931348623157E+10308, and -Infinity is displayed when a number is lower than -1.7976931348623157E+10308.

Syntax

Infinity


Tips and Notes

Note: Anything divided by Infinity is 0 and anything multiplied by Infinity is Infinity.

Example

In this example we will show what happens if a number exceeds the infinity limit:

<script type="text/javascript">
var t1=1.7976931348623157E+10308;
document.write(t1);
document.write("<br />");
var t2=-1.7976931348623157E+10308;
document.write(t2);
</script>

The output of the code above will be:

Infinity
-Infinity
JavaScript Infinity Property Reviewed by 1000sourcecodes on 03:23 Rating: 5
Powered by Blogger.