[size=medium]The with statement is used to temporarily modify the scope
chain. It has the following syntax:
This statement effectively adds object to the front of the scope chain, executes statement , and then
restores the scope chain to its original state.
Despite its occasional convenience, use of the with statement is frowned upon. JavaScript code that uses
with is difficult to optimize and may therefore run more slowly than the equivalent code written without
the with statement. Furthermore, function definitions and variable initializations within the body of a with
statement can have surprising and counterintuitive behavior.[*] For these reasons, it is recommended
that you avoid the with statement.[/size]
chain. It has the following syntax:
with (object)
statement
This statement effectively adds object to the front of the scope chain, executes statement , and then
restores the scope chain to its original state.
Despite its occasional convenience, use of the with statement is frowned upon. JavaScript code that uses
with is difficult to optimize and may therefore run more slowly than the equivalent code written without
the with statement. Furthermore, function definitions and variable initializations within the body of a with
statement can have surprising and counterintuitive behavior.[*] For these reasons, it is recommended
that you avoid the with statement.[/size]