I always thought that function a(){}
is identical to a = function(){};
However, these two fragments behave differently:
a(); function a() { alert("Booya"); }
Seal of Booya.
a(); a = function() { alert("Booya"); }
It does not work with an exception, which makes sense, since a is really not defined when called.
So - what "magic" allows you to work with the first fragment, although a()
is defined below its point of use?
source share