Function inside if statement?

liorean liorean at
Tue Feb 5 16:42:28 PST 2008

Just wanted to point out the thread starting here:

It discusses this issue. Brendan gave this answer, a few replies in:
> Since this is an ES3 extension, allowed by chapter 16, we could
> codify the majority-share practice, except that it sucks. We have so
> far avoided specifying function statements, preferring to leave them
> to implementations to experiment with, on into the ES4 future.

I did a summary of what the engines did in various browsers at:
The discussion detours a bit after that.

Also, Microsoft included these tests as section 2.9 in their "JScript
Deviations from ES3" document at:

Note that the reason Safari according to that document doesn't give
any results is that the test uses plain function declarations in the
statement bodies. If the statement bodies had been wrapped in a
statement list (curlies) then Safari would have given a profile very
similar to that of Firefox except for the
break-within-labelled-statement case, IIRC.
In other words, to do a full set of tests one need to try both the
statement-list wrapped versions and the plain function declaration
versions, because they may have differing results.
David "liorean" Andersson

More information about the Es4-discuss mailing list