Junior JavaScript

What is optional chaining?

A safe way to access nested properties without throwing an error if something is

undefined or null.

Example:

console.log(user?.address?.city);

More from JavaScript Tutorial

All questions for this course