Webmaster in a Nutshell, 3rd Edition By Robert Eckstein, Stephen Spainhour
Table of Contents
Chapter 11. JavaScript
Global
Core JavaScript 1.0; JScript 1.0; ECMA v1
Global properties and functions
this
Description
The Global object holds the global properties and methods listed. These properties and methods do not need to be referenced or invoked through any other object. Any variables and functions you define in your own top-level code become properties of the Global object. The Global object has no name , but you can refer to it in top-level code (i.e., outside of methods) with the this keyword. In client-side JavaScript, the Window object serves as the Global object. It has quite a few additional properties and methods, and can be referred to as window.
Global Properties
Infinity
A numeric value that represents positive infinity. JS 1.3; JScript 3.0; ECMA v1.
NaN
The not-a-number value. JS 1.3; JScript 3.0; ECMA v1.
undefined
The undefined value. JS 1.5; JScript 5.5; ECMA v3.
Global Functions
decodeURI( uri )
Returns a decoded copy of uri , with any hexadecimal escape sequences replaced with the characters they represent. JS 1.5; JScript 5.5; ECMA v3.
decodeURIComponent( s )
Returns a decoded copy of s , with any hexadecimal escape sequences replaced with the characters they represent. JS 1.5; JScript 5.5; ECMA v3.
encodeURI( uri )
Returns an encoded copy of uri , with certain characters replaced by hexadecimal escape sequences. Does not encode characters such as #, ?, and @ that are used to separate the components of a URI. JS 1.5; JScript 5.5; ECMA v3.
encodeURIComponent( s )
Returns an encoded copy of s , with certain characters replaced by hexadecimal escape sequences. Encodes any punctuation characters that could be used to separate components of a URI. JS 1.5; JScript 5.5; ECMA v3.
escape( s )
Returns an encoded copy of s in which certain characters have been replaced by hexadecimal escape sequences. JS 1.0; JScript 1.0; ECMA v1; deprecated in ECMA v3: use encodeURI( ) and encodeURIComponent( ) instead.
eval( code )
Evaluates a string of JavaScript code and returns the result.
isFinite( n )
Returns true if n is (or can be converted to) a finite number. Returns false if n is (or converts to) NaN (not a number) or positive or negative infinity. JS 1.2; JScript 3.0; ECMA v1.
isNaN( x )
Returns true if x is (or can be converted to) the not-a-number value. Returns false if x is (or can be converted to) any numeric value. JS 1.1; JScript 1.0; ECMA v1.
parseFloat( s )
Converts the string s (or a prefix of s ) to a number and returns that number. Returns NaN (0 in JS 1.0) if s does not begin with a valid number. JS 1.0; JScript 1.1; ECMA v1.
parseInt( s , radix )
Converts the string s (or a prefix of s ) to an integer and returns that integer. Returns NaN (0 in JS 1.0) if s does not begin with a valid number. The optional radix argument specifies the radix (between 2 and 36) to use. If omitted, base 10 is the default or base 16 if s begins with the hexadecimal prefix "0x" or "0X". JS 1.0; JScript 1.1; ECMA v1.
unescape ( s )
Decodes a string encoded with escape( ). Returns a decoded copy of s . JS 1.0; JScript 1.0; ECMA v1; deprecated in ECMA v3; use decodeURI( ) and decodeURIComponent( ) instead.