Nullish Coalescing Operator

Nullish Coalescing Operator check for both null and undefined, and will not consider 0. When as the Logical Or Operator will check it as well (falsy).

const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string"

const baz = 0 ?? 42;
console.log(baz);
// expected output: 0

Nullish Coalescing in Angular Template

With Angular 12, we have Nullish Coalescing operator in templates!

{{ value ?? '-' }}

Reference