Course lesson
Safely Access a Property on a JavaScript Array with Optional Chaining
You can use optional chaining to access elements in an array. If the array is null or undefined, attempting to access an element with optional chaining prevents an error from being thrown, returning undefined instead.
- Duration
- 0 min
- Access
- Free
- Transcript
- Available
You can use optional chaining to access elements in an array. If the array is null or undefined, attempting to access an element with optional chaining prevents an error from being thrown, returning undefined instead.