Firefox/Chrome: {} + {} etc.

Axel Rauschmayer axel at rauschma.de
Fri Jan 27 10:16:49 PST 2012


>> JS REPLs tend to parse input as Program productions.  Parsing "{} + {}" as a block followed by a unary expression is correct according to ES5 grammar for Program.  IE behaves the same.  
>> 
> 
> It's not just in Program, it's any statement context.  However, it is hard to actually observe outside of a REPL.  Try this variant
> 
> function f() {
>   {;} + {}
> }
> 
> to more clearly see what is being parsed.


What works for me is closing my left eye. ;-)
http://www.youtube.com/watch?v=46btEgKmCTo

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



More information about the es-discuss mailing list