摘要:
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 阅读全文
摘要:
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 ... 阅读全文