`
pstinghua
  • 浏览: 24115 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

with

阅读更多
[size=medium]The with statement is used to temporarily modify the scope
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]
    分享到:
    评论
    Global site tag (gtag.js) - Google Analytics