Fun impossible Firefox JS challenge

Brendan Eich brendan at
Fri Apr 13 07:46:37 PDT 2012

Latest SpiderMonkey allows just


   function true(){print('Call me');};



as the solution. This shows extensions from E4X (namespaces, extended 
with the built-in 'function::' magic) and ES4 (allowing reserved 
identifiers after 'function').

Extensions are allowed by Clause 16 of ECMA-262. But perhaps there's an 
explicit prohibition on one or both of these?

Anyway they are demons from the second age, and they're going away.


gaz Heyes wrote:
> Ok here is my solution:
> with(arguments.callee)function::['true']()
> So initially I thought the with statement was required to switch the 
> context of "function::" but this also worked:
> with(1+1)function::['true']()
> However this doesn't work on Firefox 11:
> function::['true']()
> So what I think happens is Firefox looks for the true function in the 
> window object then can't find it so falls back to the parent object 
> with is the current anon function.
> It can also be called using eval as eval is in the current scope:
> eval("function::['true']()");
> I guess the shortest you can possibly make it is:
> with(1)function::true()
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list