阅读背景:

Ensure You Are Not Adding To Global Scope in JavaScript(转)

来源:互联网 

A key best practice if you’re writing JavaScript code is to avoid adding objects to the global scope. There are several good reasons for this – globals add coupling, it makes it easier for disparate libraries to break one another, etc. A general rule of programming is to avoid global scope, in fact. Unfortunately, JavaScript makes adding things to global scope very easy. Consider this bit of code:A key best practice if you’re writing JavaScrip




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: