Watch the video and follow along with the written guide
Optional chaining allows you to safely access deeply nested properties without throwing an error if a part of the chain is null or undefined. This prevents your code from crashing or stopping unexpectedly. The operator is a question mark followed by a dot (?.). Use it when a value might not exist but if you're sure a value will always be present, there's no need to use it.
Nullish coalescing (??) is similar to the logical OR operator (||), but it only uses the fallback value if the left-hand side is null or undefined, not for other falsy values like 0, "", or false.
This is useful when you want to provide a default value only when the original value is missing, not when it's just falsy.
Write, run, and test your code in real-time