...

/

Nullish Coalescing and Null or Undefined Operands

Nullish Coalescing and Null or Undefined Operands

Learn nullish coalescing in TypeScript for default values with null or undefined variables.

Nullish coalescing

In general, it is a good idea to check that a particular variable is not either null or undefined before using it, as this can lead to errors. TypeScript allows us to use a feature of the 2020 JavaScript standard called nullish coalescing, which is a handy shorthand that will provide a default value if a variable is either null or undefined.

Access this course and 1400+ top-rated courses and projects.