[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.
发表评论
-
Extending Built-in Types
2009-01-08 13:55 738The Function.apply( ) method is ... -
Breakpoints using closures
2009-01-07 13:43 888// // This function implements ... -
Private properties with closures
2009-01-07 13:13 782// // This function adds proper ... -
Constructor Functions
2009-01-07 00:42 794the new operator creates a new ... -
Functions as Methods
2009-01-07 00:39 820When a function is invoked as a ... -
The callee Property
2009-01-07 00:02 676In addition to its array elemen ... -
Variable-Length Argument Lists: The Arguments Obje
2009-01-06 23:06 806The Arguments object has one ve ... -
Function Literals
2009-01-06 21:50 716Although function literals crea ... -
Nested Functions
2009-01-06 21:09 776Nested functions may be defined ... -
Deleting Array Elements
2009-01-05 22:11 591The delete operator sets an arr ... -
Reading and Writing Array Elements
2009-01-05 22:00 787Note that array indexes must be ... -
The valueOf() Method
2009-01-05 18:05 765... -
The toLocaleString() Method
2009-01-05 18:02 874In ECMAScript v3 and JavaScript ... -
The constructor Property
2009-01-05 17:51 803[size=medium]Since constructor ... -
the empty statement
2009-01-05 00:29 802[size=medium]When you intention ... -
try/catch/finnaly
2009-01-05 00:17 905If control leaves the try bloc ... -
throw
2009-01-04 23:56 708The tHRow statement has the fol ... -
return
2009-01-04 23:52 826If a function executes a return ... -
functions
2009-01-04 23:48 818[size=medium]Technically speaki ... -
Labels
2009-01-04 23:01 723Label names are distinct from v ...
相关推荐
Focusing on implementation rather than theory, 'Statistical Computing with R' serves as a valuable tutorial, providing examples that illustrate programming concepts in the context of practical ...
with the Invariant Sections being “Free Software” and “Free Software Needs Free Documentation”, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. ...
根据提供的信息,我们可以总结并详细解释与“debugging_with_gdb(中文版pdf)”相关的知识点。这份文档似乎是一份关于使用 GDB(GNU Debugger)进行调试的手册或指南的中文版 PDF 文件。GDB 是一个非常强大的开源调试...
Mobile App Development with Ionic 2: Cross-Platform Apps with Ionic, Angular, and Cordova by Chris Griffith English | 10 Apr. 2017 | ASIN: B06Y5Q24B2 | 310 Pages | AZW3 | 2.93 MB Learn how to build ...