-
Notifications
You must be signed in to change notification settings - Fork 24
[docs] Include examples not related to ?.
#2
Comments
Agreed - this operator is useful on its own. It's also particularly useful in jsx with React: <div>
{ifZeroThisIsAFootgun && bar}
{!!thisIsTheCurrentWorkaround && bar}
{orThis ? bar : null}
{butThisIsAlwaysSafe ?? bar}
</div> |
I find |
@ljharb I think in your example you actually want a different operator.
One way of thinking about it is that, for these use cases, |
@alangpierce that is in fact exactly what I want, because in the common use case, the first operand is always |
Seconding this as it wasn't clear to me from the README alone that this would be possible (had to look through the issues). |
This is a proposal that would be beneficial regardless of whether
?.
passes.eg;
The text was updated successfully, but these errors were encountered: