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


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.


More information about the es-discuss mailing list