ES3.1 Draft: 11 June 2008 version available

Mark S. Miller erights at
Mon Jun 16 08:39:55 PDT 2008

On Sat, Jun 14, 2008 at 11:43 PM, Garrett Smith <dhtmlkitchen at> wrote:
> The spec doesn't mention that FunctionExpression with Identifier can
> affect scope chain. Example:-
> (function f() {
>  var propertyIsEnumerable = 0;
>  (function f() {
>        alert(propertyIsEnumerable); //=> native code
>  })();
> })();

Hi Garrett, thanks for alerting us to this bizarre behavior. I had no
idea. I did reproduce this behavior and minor variants. However,
oether variants didn't work, indicating that I don't yet understand
what's happening here. For example, on Firefox in squarefree:

    var g = function f() { return x; }

    ReferenceError on line 1: x is not defined

    g.x = 3;

    ReferenceError on line 1: x is not defined

As I thought I understood this example, I would have expected the last
call to g() to return 3. Can someone explain why it doesn't?


More information about the Es4-discuss mailing list