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

-20

u/OmgImAlexis Nov 10 '20

This is a worse way of doing it.

11

u/threeys Nov 10 '20

Why is it worse?

-6

u/OmgImAlexis Nov 10 '20 edited Nov 10 '20

It’s harder to read the intent and doesn’t add anything helpful for the few chars it saves.