Check out example codes for "typescript null and undefined check". It will help you in understanding the concepts better.

Code Example 1

let x = foo?.bar.baz();

Code Example 2

if(!!someValue)

Learn ReactJs, React Native from akashmittal.com