js 闭包演示
function test2() { var scope = "global scope"; var f = enclose(scope); scope = 'aaa'; alert(f()); } function enclose(word) { function f() { return word; } return f; } test2();
function test2() { var scope = "global scope"; var f = enclose(scope); scope = 'aaa'; alert(f()); } function enclose(word) { function f() { return word; } return f; } test2();