Optional Chaining
Definition
The `?.` operator that safely accesses deeply nested object properties without throwing if an intermediate value is `null` or `undefined`. Returns `undefined` instead of throwing a TypeError.
Code Example
Javascript
Tip: Modify the code above and click “Run” to see the results
Learn More
Related Terms
Destructuring
A syntax for extracting values from arrays or properties from objects into distinct variables. Destructuring simplifies code and is commonly used in function parameters, imports, and React hooks.
Nullish CoalescingThe ?? operator that returns the right-hand operand when the left-hand operand is null or undefined. Unlike ||, it does not treat 0, '', or false as nullish, making it safer for default values.