摘要: JavaScript is a lexically scoped language: the scope of a variable can be thought of as the set of source code lines for which the variable is defined. Global variables are defined throughout the program.Local variables are defined throughout the function in which they are declared, and also within 阅读全文
posted @ 2013-01-14 20:06 arthur_d 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 1 uniqueInteger.counter = 0;2 function uniqueInteger(){3 return uniqueInteger.counter++;4 }we defined a uniqueInteger() function that used a property of the function itself to keep track of the next value to be returned. A shortcoming of that approach is that buggy or malicious code could reset ... 阅读全文
posted @ 2013-01-14 19:58 arthur_d 阅读(130) 评论(0) 推荐(0) 编辑