1. Home
  2. Computing & Technology
  3. JavaScript

Infinity

By , About.com Guide

Definition: Infinity is a global property (variable) with a constant value. If the result of a mathematical calculation would result in a number that is to big to be held in a Javascript numeric field then this value is assigned to the field instead. This allows you to test the result of a calculation to see if the answer has overflowed the maximum allowable value. While this value is assigned as a result of a numerical calculation testing the value itself is not a numerical value. This is not a reserved word so you can declare your own variable or function called Infinity but if you do then you will not be able to reference the global property to test for numerical overflow.
Examples:
if (x == Infinity)
Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Reference
  5. Javascript Glossary - Infinity

©2009 About.com, a part of The New York Times Company.

All rights reserved.