August 1999
Intermediate to advanced
1488 pages
72h 53m
English
with(object){ code; }
The with statement takes an object and refers to all of the properties, methods, and events of that object within the code without directly referencing the object itself. This allows you to use these characteristics of an object, such as the Math object, without specifically referencing the object.
Listing 6.273 creates a variable, and then assigns it and the methods called on it, as a Math object. Because the with statement is used, you do not have to reference the methods via the instance of this object.
<script language="JavaScript"> <!–– Hide // Define the variables ... |
Read now
Unlock full access