please add orEqual operator

myemailum14 at gmail.com myemailum14 at gmail.com
Mon Aug 10 13:09:24 UTC 2015


Thanks I'll be searching through archive, and yea i think this is something
very simple and yet innovative.

On Mon, Aug 10, 2015 at 3:55 AM, Peter van der Zee <ecma at qfox.nl> wrote:

> On Mon, Aug 10, 2015 at 3:50 AM,  <myemailum14 at gmail.com> wrote:
> > Isn't
> > prop ||= 0;
> > better than
> > prop = prop || 0;
> > and it can be even defined like this.
> > prop ||= var1 ||= var2 ||= 0;
> > but then i dont know how we can use it ike this
> > if (num == 3 ||=4 ||=6)
>
> Sounds like you want two operators; `||=` for the compound assignment
> case and `||==` and `||===` for the "compare the RHS to the LHS of the
> last `===` or `==` op", or something like that. Defining a single op
> for both of these cases is likely to lead to ambiguity.
>
> The `||=` (and `&&=`) case has been discussed a couple of times, look
> in the esdiscuss archives.
> I'm sure something like `||==` has been discussed too though I don't
> recall it myself. I tend to use switches myself for this in case perf
> is an issue.
>
> - peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150810/602af4b6/attachment.html>


More information about the es-discuss mailing list