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.
Be careful that you don't accidentally assign new values to the Infinity and NaN properties of the global object. Some implementations do not properly protect them against being written to and your script may assign new values to them. This can lead to very unpredictable behavior.
Prev | Home | Next |
SPAN object | Up | Special type |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |