Course lesson
Safely Access a Property on a JavaScript Object with Optional Chaining
You can use optional chaining to access properties of an object. If the parent property exists, it acts as a typical dot accessor. If not, optional chaining prevents an error from being thrown and instead returns undefined.
- Duration
- 1 min
- Access
- Free
- Transcript
- Available
You can use optional chaining to access properties of an object. If the parent property exists, it acts as a typical dot accessor. If not, optional chaining prevents an error from being thrown and instead returns undefined.