From: John G Harris on
On Wed, 26 May 2010 at 13:14:54, in comp.lang.javascript, Ry Nohryb
wrote:

<snip>
>Q: It looks like a function declaration, walks like a function
>declaration, and quacks like a function declaration, and the specs
>*permit* a function declaration there because syntax extensions are
>permitted, so what ?
>A: That this FAQ entry is pointless in the way it's worded right now.

You need to be accurate : ECMAScript permits extensions, but it's only a
Function Declaration if you say it is.

As you do say it is, you have to require it to be processed the way that
ECMA 262 requires Function Declarations to be processed. That is, the
declaration is processed *before* the code surrounding it is executed.

As a result, the function is declared unconditionally. Even if the
declaration is inside an if, while, or for statement the declaration is
always actioned even if code execution never passes through the
declaration text.

As Function Declarations are actioned unconditionally it is completely
pointless to hide them inside any kind of Statement. It is worth while
pointing this out to beginners.

You have demonstrated that this is what IE and a few others do. You have
also demonstrated that Mozilla is incompatible. It is worth while
warning beginners of this : they can't predict how their code is going
to behave if they use this extension.

John
--
John Harris