r/node • • Nov 10 '20

Conditionally call a function with optional chaining.

Post image
345 Upvotes

126 comments sorted by

View all comments

Show parent comments

8

u/recycled_ideas Nov 10 '20

Of course you're unfamiliar with it, because when you look at it, it's not clear.

That's on you, because the meaning is explicit.

-5

u/OmgImAlexis Nov 10 '20

No.

1

u/recycled_ideas Nov 10 '20

Optional chaining does exactly the same thing as the if, but in significantly fewer characters.

The only reason for it to be less clear is because you're unfamiliar with it. Because, again, the functionality is identical.