||= is much needed?

T.J. Crowder tj at crowdersoftware.com
Thu Jun 14 11:16:09 PDT 2012


On 14 June 2012 19:01, Brendan Eich <brendan at mozilla.com> wrote:

> The users who want null to be distinct from undefined are neither
> CoffeeScript users, nor || users (in their defaulting code). They must be
> doing === undefined test.
>

Not quite. I use || whenever I can in my defaulting code, and I can use it
a lot (e.g., when the optional item must be an object). I only use the
long-winded version if I have to because 0, "", false, or null is a valid
possible value -- which is surprisingly rare. Hugely looking forward to
using ?? uniformly instead, but it's not accurate to say that we who don't
want undefined and null equated in this context are therefore not using ||.

-- T.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120614/a5ba9997/attachment.html>


More information about the es-discuss mailing list