阅读背景:

不使用全局变量访问其他函数中的变量

来源:互联网 

I've heard from a variety of places that global variables are inherently nasty and evil, but when doing some non-object oriented Javascript, I can't see how to avoid them. Say I have a function which generates a number using a complex algorithm using random numbers and stuff, but I need to keep using that particular number in some other function which is a callback or something and so can't be part of the same function. I've heard from a variety of places that global




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

分享到: