Implemented in | Navigator 2.0, LiveWire 1.0 |
Syntax
with (object){
statements
} Arguments
object | Specifies the default object to use for the statements. The parentheses around object are required. |
statements | Any block of statements. |
Examples
The following with
statement specifies that the Math
object is the default object. The statements following the with
statement refer to the PI
property and the cos
and sin
methods, without specifying an object. JavaScript assumes the Math
object for these references.
var a, x, y
var r=10
with (Math) {
a = PI * r * r
x = r * cos(PI)
y = r * sin(PI/2)
}
Last Updated: 10/31/97 12:29:59