DEV Community

Discussion on: What is Optional Chaining in JavaScript?

Collapse
 
niu_tech profile image
niu tech

You can use this syntax today in every browser without transpiling:

const city = ((user||{}).address||{}).city;

That said, optional chaining is natively supported in Chrome 80+.