Proposal for a null coalescing operator
Isiah Meadows
isiahmeadows at gmail.com
Mon Aug 17 00:59:56 UTC 2015
This is something I frequently make a helper function out of.
```js
function d(argument, default_) {
return argument != null ? argument : default_
}
```
On Sun, Aug 16, 2015, 20:34 Brandon Andrews <warcraftthreeft at sbcglobal.net>
wrote:
> https://en.wikipedia.org/wiki/Null_coalescing_operator
>
> Essentially x ?? y will return x when not null or undefined else it will
> return y.
>
>
> A nice Javascript explanation of the current problems with using || that
> can cause unforeseen bugs:
>
> http://stackoverflow.com/a/476445
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150817/533aef3a/attachment.html>
More information about the es-discuss
mailing list