W3Schools.com

JavaScript Infinity Property

Function Reference JavaScript Global Functions

Definition and Usage

Infinity is a numeric value that represents positive infinity.

-Infinity is a numeric value that represents negative infinity.

Infinity is displayed when a number exceeds the upper limit of the floating point numbers, which is 1.7976931348623157E+10308.

-Infinity is displayed when a number exceeds the lower limit of the floating point numbers, which is -1.7976931348623157E+10308.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The Infinity property is supported in all major browsers.


Example

Example

Display a number that exceeds the limit of the floating point numbers:

<script type="text/javascript">

var x=1.7976931348623157E+10308;
document.write(x + "<br />");

var y=-1.7976931348623157E+10308;
document.write(y);

</script>

The output of the code above will be:

Infinity
-Infinity

Try it yourself »


Function Reference JavaScript Global Functions
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE