Proposal for a null coalescing operator

Michael McGlothlin mike.mcglothlin at gmail.com
Mon Aug 17 09:54:20 UTC 2015


Another place JS would create a consideration is NaN. You might want that to play well with the operator. Possibly you could consider ?? for a wider range of nullish values and ??? for ONLY undefined.

x = parseInt ("a") ?? 42
x = a.nada ??? 42





📱 Michael McGlothlin

> On Aug 16, 2015, at 10:32 PM, Kevin Smith <zenparsing at gmail.com> wrote:
> 
> A link to a wikipedia article is not *actually* a proposal : )
> 
> As Michael points out, you need to at least provide some consideration for null vs. undefined.  I would also like to see some thought given to how such an operator might interact with a null propagation operator, discussed here:
> 
> https://esdiscuss.org/topic/existential-operator-null-propagation-operator
> 
> (Link appears to be temporarily not working...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150817/5e4ed213/attachment.html>


More information about the es-discuss mailing list