[email protected] 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.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

