Closed
Description
->
var a
->
a!
a = ->
->
var a
->
a!
compiles to
(function(){
var a;
return function(){
var a;
a();
return a = function(){};
};
});
(function(){
var a;
return function(){
return a();
};
});
In the first function, because a
is assigned after the call, a new var is created causing a
to be undefined.
But in the second top-level function, a
is not assigned, and so a
is not undefined. (actually it is, but it wouldn't be if I'd assigned something before creating the nested function)
I wouldn't expect a new var to be created in the first one.
Activity