Use the Optional Chaining Operator to Simplify Checking for Nullish Values

InstructorSam Selikoff

Share this video with your friends

Send Tweet

The Optional Chaining Operator, ?., can be used as a simple way to check if a variable has a nullish value (null or undefined). Instead of littering your app with checks like data && data.movies, you can write data?.movies instead.

Check out the Optional chaining MDN docs to read more about the new operator.