mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
10 lines
192 B
JavaScript
10 lines
192 B
JavaScript
// Function call variable scoping
|
|
// also garbage collection as scope will cause circular link
|
|
|
|
function foo() {
|
|
var r = 40;
|
|
return function(x) { return r+x; };
|
|
}
|
|
|
|
result = foo()(2) == 42;
|