- added Lexer can now detect regular expression literals but using of regular expression are currently unsupported - added function closure test "tests/42tests/test002.js"master
parent
f275444f82
commit
ee120b008f
@ -0,0 +1,12 @@
|
|||||||
|
// function-closure
|
||||||
|
|
||||||
|
var a = 40; // a global var
|
||||||
|
|
||||||
|
function closure() {
|
||||||
|
var a = 39; // a local var;
|
||||||
|
return function() { return a; };
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = closure(); // the local var a is now hidden
|
||||||
|
|
||||||
|
result = b()+3 == 42 && a+2 == 42;
|
Loading…
Reference in new issue