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

-13

u/OmgImAlexis Nov 10 '20

An if statement would be a lot easier to read. I don’t see any reason to use this.

Just because you can do it doesn’t mean you should.

7

u/wobsoriano Nov 10 '20

If you look at the screenshot example, there is no if statement. I'm comparing it with

myFunction && myFunction();

-16

u/OmgImAlexis Nov 10 '20

You don’t say...

I’m saying an if would have been better. Even the example you’re comparing it to isn’t the best.

5

u/wobsoriano Nov 10 '20

Sure thing. That is noted sir.

-15

u/OmgImAlexis Nov 10 '20

Not a guy.

3

u/wobsoriano Nov 10 '20

*ma'am.

-19

u/OmgImAlexis Nov 10 '20

No need for either and I never said I’m a women or use ma’am. It’s 2020 learn.

8

u/wobsoriano Nov 10 '20

Okay. Point taken 😃

13

u/giggly_kisses Nov 10 '20

It’s 2020 learn.

Like new syntax? :D

2

u/avinashnaikb Nov 10 '20

I apologise on behalf of my fellow human.

0

u/monsto Nov 10 '20

ok NOW you need lighten up.

Dude was patient with you, trying to help you understand. But you've been bitchy the whole time. And piled on top of it, you jumped at the opportunity to grandstand gender topics. Like a vegan that can't wait to tell you they're vegan.

So here's how you get treated like everyone else: Nobody cares about any of that. It doesn't figure into the conversation about optional chaining at all.

Google is your friend. So rather than bitching about shit when someones trying to help... it's 2020. Learn.