| re: Nested function X vs. nested varX = function
"Richard A. DeVenezia" <radevenz@ix.netcom.com> wrote in message news:<bji3j2$jjdus$1@ID-168040.news.uni-berlin.de>...
[color=blue]
> Where is a good reference discussing the 'one-pass' or 'first-pass' ?[/color]
The ECMA-262 standards, although it will not use that terminology. See
the section on execution contexts.
[color=blue]
> These seem to do the same thing, beyond the source code differences, are
> there any differences ?[/color]
I believe they are so minimal as to be irrelevant (unless someone sees
something I do not). But here is one. Change the "return" statements
to "return bar.toString()" and compare the results. The first is a
named function object; the second is an anonymous function object
assigned to a variable.
At first I was unsure of the intent of your first function's return.
Is it "return;" or "return function bar (x) {return x*x};"? I figured
it was the former, otherwise your question would not make sense.
If you use a code cruncher, the lack of ";" will bite you someday. |