That's easy enough to test. var y=20;
function foo(x) { var tmp = 3; var y = 20; return function (y) { alert(x + y + (++tmp)); }
var bar = foo(2); // bar is now a closure.
bar(10);
This makes no difference. The alert runs once, and displays 16.
That's easy enough to test. var y=20;
}var bar = foo(2); // bar is now a closure.
bar(10);
This makes no difference. The alert runs once, and displays 16.