DEV Community

Cover image for Nibbles: Optional chaining
Andrew Bone
Andrew Bone

Posted on

6 3

Nibbles: Optional chaining

The optional chaining operator allows you to simply check deep chains in a within an object without having to verify every step.

Syntax

object?.prop1?.prop2?.prop3
Enter fullscreen mode Exit fullscreen mode

Example

Support

Current support is all major browsers except IE.

Further reading

Optional chaining
caniuse

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more