V
VK
Michael said:Exactly equivalent? No, certainly not. However, in most ways that
matter, they are the same.
"ways that matter" is a dangerous term: it may cover too many things in
too ambiguous way (say OOP or not OOP, inheritance emulation or native
inheritance: these issues can be dismissed by this term as well
occasionally).
function f() {}
and
var f = function(){};
have the same internal difference as:
var f = new Function;
and
var a = new Function;
var f = a;
(I am talking about referencing and memory representation, not about
FunctionStatement vs FunctionExpression differences).
Is this matter or not? It depends on circumstances. At the very least
an universal finalizing "it is not matter" is not applicable here.
You have that backwards.
Yep. I wanted to follow-up correction right away, but decided to give
the pleasure of correction to experts.
How is that useful or helpful to anyone? What pertinent information do
you even think it shows? As far as I can see, all it demonstrates is the
choices that Microsoft Script Debugger makes when referring to functions.
<http://www.geocities.com/schools_ring/blogs/Image1FF.gif>
shows the stack state for var something = function(){}
<http://www.geocities.com/schools_ring/blogs/Image2FF.gif>
shows the stack state for function something(){}
If you insist, I can use a full-scaled C++ spy so we would count "one
against two" on a big UA-independed picture. But it will most probably
make me all upset and grunchy afterwards (as any person vasted his time
on useless experiment). :-|
Whether they look silly or depends upon how they use the latter.
Thinking back I see some sense in using
var f = function f(){} // both identifiers are the same
That allows to normalize function toString results and to use function
name instead if arguments.callee. Still a bit weird looking but at
least it may have some sense.