please add orEqual operator
herby at mailbox.sk
Mon Aug 10 19:26:54 UTC 2015
myemailum14 at gmail.com wrote:
> I one day writing js thought why there is no operator for ||= there
The problem with || (and, consequently, ||=) is that it uses ToBoolean.
We have all used to it, but I'd bet what we mostly want is "if (x ==
null) ...", so I think ||= should NOT be added to the language and ||
used as value || anotherValue should be left to rot (as a boolean
short-circuit in if/while it is, of course, indispensable); on the other
hand, we should add something like value ?? anotherValue and lvalue ??=
anotherValue, instead, which would only kick in case of null/undefined.
> should be syntax makes sense, then i learned some ruby and it had this
> already. Now i was convinced it makes sense afterall.
More information about the es-discuss