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 <[email protected]> wrote: > On Mon, Aug 10, 2015 at 3:50 AM, <[email protected]> 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 >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

