Special number values (Definition)

Special properties of the Global and Number objects.

Special number values are provided so that scripts can test for exceptional values yielded as a result of arithmetic expressions.

You can check for infinity or non-number errors as a result of a divide by zero for example. Maximum and minimum values are also available to range check input data to make sure it can be used in arithmetic computations.

You cannot assign constant values of Infinity or NaN because you cannot type in a constant value to denote them. However because they exist as properties of the Global object, you can refer to them by name.


See also:Infinity, NaN, Number.MAX_VALUE, Number.MIN_VALUE, Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY


Wrox Instant JavaScript - page 14