R
Richard A. DeVenezia
These seem to do the same thing, beyond the source code differences, are
there any differences ?
function foo () {
y = bar(2)
return
function bar (x) {return x*x}
}
function foo () {
var bar = function(x) { return x*x }
y = bar(2)
return
}
I recall Lasse mentioning a one-pass. Now I see it, In the first foo the
bar function is available prior to it's definition because of the one-pass.
In the second foo, the function var bar has to be assigned before it can be
used.
Where is a good reference discussing the 'one-pass' or 'first-pass' ?
there any differences ?
function foo () {
y = bar(2)
return
function bar (x) {return x*x}
}
function foo () {
var bar = function(x) { return x*x }
y = bar(2)
return
}
I recall Lasse mentioning a one-pass. Now I see it, In the first foo the
bar function is available prior to it's definition because of the one-pass.
In the second foo, the function var bar has to be assigned before it can be
used.
Where is a good reference discussing the 'one-pass' or 'first-pass' ?