Nullish coalescing operator allows to assign a variable if it’s not null or undefined, or an expression otherwise.
a = b ?? other
It is an improvement over previously used
|| will also assign other if b is empty string or other falsy, but not nullish value.
However sometimes, we also use
&& for value assignment, for example
a = b && func(b)
where we only want to do func on b if it’s not nullish, otherwise assign the nullish b.
&& checks for falsiness, not nullishness. Is there a nullish version of