DEV Community

Viral Patel
Viral Patel

Posted on • Originally published at viralpatel.blog on

2 1

Optional Chaining in JavaScript

Optional chaining enables capabilities for Javascript developers to perform a nil check on the objects before trying to access any object properties.

As an example:

this.props?.user?.email

Optional Chaining behaves similarly to Ruby’s pretzel(&) operator.

Check out the official babel documentation. Babel - Optional Chaining

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more