阅读背景:

为什么全局变量被认为是不良做法?

来源:互联网 

I keep seeing warnings not to use global variables in JavaScript, but it seems that the only reason people say that is because the clogs up the global namespace. I can imagine this being easily fixed by putting all of the variables into one big object. Now the question is: are there any other reasons not to use global variables other than convenience sake? Are there any performance or compatibility issues involved with them?I keep seeing warnings not to use global variab




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

分享到: