Sets the seconds of the UTC date time.
Returns the milliseconds of the date time. Note that
this does not refer to the milliseconds since January 1,
1970, but rather the number of milliseconds in the cur-
rent time, such as 4:55:34.20, where 20 is the number
of milliseconds of the time.
Returns the milliseconds of the UTC date time.
Sets the milliseconds of the date time.
Sets the milliseconds of the UTC date time.
ECMA-262 defines a
as “any object supplied by an ECMAScript implementation, indepen-
dent of the host environment, which is present at the start of the execution of an ECMAScript program.”
This means the developer does not need to explicitly instantiate a built-in object; it is already instanti-
ated. Only two built-in objects are defined by ECMA-262:
(which are also both native
objects because by definition, every built-in object is a native object).
The Global object
object is the most unique in ECMAScript because, for all intents and purposes, it doesn’t
exist. If you try typing the following line, you get an error:
var pointer = Global;
The error would say that
is not an object, but didn’t I just say that it is an object? Yes. The
main concept to understand is this: In ECMAScript no standalone functions exist; all functions must
be methods of some object to actually exist. So functions covered earlier in this book such as
only look like they are standalone functions. In reality,
they are all methods of the
object. But these are not the only methods for the
methods are used to encode URIs (Uniform Resource
Identifiers) to be passed to the browser. To be valid, a URI cannot contain certain characters, such as
spaces. These methods help to encode the URIs so that a browser can still accept and understand them,
replacing all invalid characters with a special UTF-8 encoding.
method is designed to work on an entire URI (for instance,
is designed to work solely on a segment of a
URI (such as
from the previous URI). The main difference between the two meth-
ods is that
does not encode special characters that are part of a URI such as the colon, for-
ward slash, question mark, and pound sign;
encodes every non-standard
character it finds. For example:
var sUri = “http://www.wrox.com/illegal value.htm#start”;
06_579088 ch03.qxd 3/28/05 11:36 AM Page 81