Ubiquitous conditionals

Herby Vojčík herby at mailbox.sk
Mon Jan 23 10:43:21 PST 2012


Hello,

not very often, but also not very rare, is there the case of this kind 
of code:

   var result = {
     model: model,
     seats: seats
   };
   if (space) {
     result.truck = true;
     result.space = space;
   }

Object literal extension (and get/set before them) have shown that 
blocks can be used in object literal.

I propose to have possibility to write

     var result = {
     model: model,
     seats: seats,
     if (space) {
       truck: true,
       space: space
     }
   };

in object literal, and similar possibility of conditional definition in 
the body of a class.

Herby


More information about the es-discuss mailing list