摘要: 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. 阅读全文
posted @ 2011-08-24 10:16 yhql_916 阅读(502) 评论(0) 推荐(0) 编辑