1. 1
    Using the Null Coalescing operator with TypeScript 3.7
    1m 28s

Using the Null Coalescing operator with TypeScript 3.7

Rich Buggy
InstructorRich Buggy

Share this video with your friends

Send Tweet

The videos shows you how to use the null coalescing operator (??) instead of logical or (||) to set default values in TypeScript 3.7 to prevent expected bugs in your code.

Falk
Falk
~ 2 years ago

For correct I would have used val != null ? val : 0.5.

However, the new operator will make this even shorter and more readable, very nice!

Is this only a TS feature or will this go into the coming ES releases?

Rich Buggy
Rich Buggyinstructor
~ 2 years ago

There's a TC39 proposal to add it to ES.