Operators ||= and &&=
Brendan Eich
brendan at mozilla.com
Mon May 4 22:26:44 PDT 2009
On May 4, 2009, at 9:35 PM, Garrett Smith wrote:
> In previous discussion of ES4 (now obsolete), someone (Brendan?)
> mentioned ||= and &&= short-circuit operators. I was interested, but
> have heard nothing further on the topic.
>
> Was the idea abandoned?
Not at all, but some discussion involving ??= instead kind of trailed
off. See
https://mail.mozilla.org/pipermail/es5-discuss/2008-August/
thread.html#502
I think ||= makes sense given the extant JS idiom: var foo = arg ||
defaultFoo; that is widely used.
&&= doesn't have a real-world use-case.
??= and ?? are too narrowly typed for JS.
/be
More information about the es-discuss
mailing list