Espruino/tests/test_closure_variable_scoping_and_gc.js
Michael Duerinckx 7f5308590b Rename numbered tests to something more descriptive - closes #16
test077 is the only one I really couldn't figure out what it was meant
to test.
2014-03-01 22:15:28 +00:00

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;