摘要:
In JavaScript,scope iskept within functions, but not within blocks (such as while, if, and for statements).// Set a global variable, foo, equal to testvar foo = "test";// Within an if blockif ( true ) {// Set foo equal to 'new test'// NOTE: This is still within the global scope!var 阅读全文