摘要:
Whenever you see the function keyword within another function, the inner function has access to variables in the outer function.function foo(x) { var tmp = 3; function bar(y) { alert(x + y + (++tmp)); } bar(10);}foo(2)This will always alert 16, becausebarcan access thexwhich was defined as an argum. 阅读全文