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

Mark S. Miller erights at google.com
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
this;}});
    alert((function(){"use strict"; return foo;})());


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110502/287afaa4/attachment.html>


More information about the es-discuss mailing list