P粉7764125972023-08-10 09:55:56
Nullish coalescing operator (??) is used to test whether a value is not equal to null
or undefined
, rather than determining whether it is a "true value" .
""
is a false value, but it is neither null
nor undefined
.
Use the logical OR (||) operator to test for "truth".