ES5 riddle -- this binding in accessors accessed as global vars

Mark S. Miller erights at
Mon May 2 16:43:58 PDT 2011

According to the ES5 spec, should the following program alert the global
object or undefined? Why?

    Object.defineProperty(this, 'foo', {get:function(){"use strict"; return
    alert((function(){"use strict"; return foo;})());

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list