Ubiquitous conditionals

Rick Waldron waldron.rick at gmail.com
Tue Jan 24 18:22:05 PST 2012


The monocle shines here... (comments inline)

On Mon, Jan 23, 2012 at 1:43 PM, Herby Vojčík <herby at mailbox.sk> wrote:

> 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;
>  }
>

var result = {
      model: model,
      seats: seats
    };

if ( space ) {
  result.{
    truck: true,
    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
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120124/7b8c9ee2/attachment.html>


More information about the es-discuss mailing list