r/node • • Nov 10 '20

Conditionally call a function with optional chaining.

Post image
345 Upvotes

126 comments sorted by

View all comments

2

u/nevatalysa Nov 10 '20

Not a personal fan of it, as this would make it seem as if the object has a property that's the actual call (yes i know of Function.call()), which without the name seems off. If it was actually myFunc?.call(), which would optionally call the function (basically the example, just with an actual property name) I wouldn't see this as off-putting.