3
The Nullish coalescing operator (??) tests if a value is not null
or undefined
, not if it is truthy.
""
is a falsy value, but it isn’t null
and it isn’t undefined
.
Use the Logical OR (||) operator to test for truthiness.
Source:stackexchange.com