Global Object
Global Object
Description
An intrinsic object whose purpose is to collect global methods into one object.
Syntax
The Global object has no syntax. You call its methods directly.
Remarks
The Global object is never used directly, and cannot be created using the new operator. It is created when the scripting engine is initialized, thus making its methods and properties available immediately.
Infinity Property
Description
Returns an initial value of Number.POSITIVE_INFINITY.
Syntax
Infinity
Remarks
The Infinity property is a member of the Global object, and is made available when the scripting engine is initialized
isFinite Method
Description
Returns a Boolean value that indicates if a supplied number is finite.
Syntax
isFinite(number)
The number argument is a required numeric value.
Remarks
The isFinite method returns true if number is any value other than NaN, negative infinity, or positive infinity. In those three cases, it returns false.
isNaN Method
Description
Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).
Syntax
isNaN(numvalue)
The numvalue argument is the value to be tested against NaN.
Remarks
The isNaN function returns true if the value is NaN, and false otherwise. You typically use this function to test return values from the parseInt and parseFloat methods.
Alternatively, a variable could be compared to itself. If it compares as unequal, it is NaN. This is because NaN is the only value that is not equal to itself.
escape Method
Description
Encodes String objects so they can be read on all computers.
Syntax
escape(charstring)
The charstring argument is a String object to be encoded.
Remarks
The escape method returns a new String object (in Unicode format) that contains the contents of charstring. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, a space is returned as "%20."
Characters with a value greater than 255 are stored using the %uxxxx format.
unescape Method
Description
Decodes String objects encoded with the escape method.
Syntax
unescape(charstring)
The charstring argument is a String object to be decoded.
Remarks
The unescape method returns a new String object that contains the contents of charstring. All characters encoded with the %xx hexadecimal form are replaced by their ASCII character set equivalents.
Characters encoded in %uxxxx format (Unicode characters) are replaced with the Unicode character with hexadecimal encoding xxxx.
parseFloat Method
Description
Returns a floating-point number converted from a string.
Syntax
parseFloat(numstring)
The numstring argument is a string that contains a floating-point number.
Remarks
The parseFloat method returns an numerical value equal to the number contained in numstring. If no prefix of numstring can be successfully parsed into a floating-point number, NaN (not a number) is returned.
parseFloat("abc") // Returns NaN. parseFloat("1.2abc") // Returns 1.2.You can test for NaN using the isNaN method
parseInt Method
Description
Returns an integer converted from a string.
Syntax
parseInt(numstring, [radix])
The parseInt method syntax has these parts:
Part Description numstring Required. A string to convert into a number. radix Optional. A value between 2 and 36 indicating the base of the number contained in numstring. If not supplied, strings with a prefix of '0x' are considered hexidecimal and strings with a prefix of '0' are considered octal. All other strings are considered decimal.
Remarks
The parseInt method returns an integer value equal to the number contained in numstring. If no prefix of numstring can be successfully parsed into an integer, NaN (not a number) is returned.
parseInt("abc") // Returns NaN. parseInt("12abc") // Returns 12.You can test for NaN using the isNaN method.

