In JS, an Object can be deeply nested structure of objects. More often than not, you will encouter this kind of nested objects while
- Fetching JSON data
- Using configuration objects
- having optional properties
We have to manually check the existence of a property.
The optional chaining operator (
?.) permits reading the value of a property located deep within a chain of
connected objects without having to expressly validate that each reference
in the chain is valid.
Optional chaining makes the syntax much more better and
readable. You can just use
?. instead of adding && operator for each level of the tree. You can get more in depth
info here.
Subscribe by Email
Follow Updates Articles from This Blog via Email



No Comments