Opposite of nullish coalescing operator

This will not answer the question since it was already answered by @str, I'm just posting this here because I don't have enough rep to comment on @Dalou's answer and don't want people to trip on that answer.

a = (b ?? false) && other

Is not the opposite of ??, since a will take the value of b if b is a falsy value other than undefined/null, like '' or 0 for example. The opposite of ?? should set a to the value of other even if b is '' or 0.


To my knowledge, there is no such operator and also no proposal to add one. Instead you can rely on the standard way to check for nullish values: b == null

a = b == null ? b : func(b)