I'd probably do something like x = y ?? ( parseInt(z) || undefined) ?? 42
Thanks, Michael McGlothlin Sent from my iPhone > On Aug 17, 2015, at 5:01 AM, Herby Vojčík <he...@mailbox.sk> wrote: > > > > Michael McGlothlin wrote: >> Another place JS would create a consideration is NaN. You might want >> that to play well with the operator. Possibly you could consider ?? for > > You've got || for "wider range of nullish values". Proposal (and, in my case, > personally felt need) for ?? is to only cover null and undefined (== null) > selection. > >> 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 <zenpars...@gmail.com >> <mailto:zenpars...@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...) >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss