[Vuejs]-Why is an empty string rendered in vue.js template considered truthy?

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.

Leave a comment