1. Home
  2. Computing & Technology
  3. JavaScript

Infinity

By Stephen Chapman, About.com

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

More from About.com

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

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

All rights reserved.