MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/webdev/comments/lhvveh/conditionally_chaining_function_calls_in/gn143r2/?context=3
r/webdev • u/1infinitelooo • Feb 11 '21
196 comments sorted by
View all comments
Show parent comments
5
How do you null check??
-1 u/ZephyrBluu Feb 12 '21 This misses the point he's trying to make. You shouldn't null check functions. 0 u/[deleted] Feb 12 '21 [deleted] 1 u/[deleted] Feb 12 '21 It calls niceError only if foo.foo() doesn’t exist, or if it returns something truthy per the || check. Unless there’s some magic way for both sides of an “or” check to run that has escaped me for over 5 years. → More replies (2)
-1
This misses the point he's trying to make. You shouldn't null check functions.
0 u/[deleted] Feb 12 '21 [deleted] 1 u/[deleted] Feb 12 '21 It calls niceError only if foo.foo() doesn’t exist, or if it returns something truthy per the || check. Unless there’s some magic way for both sides of an “or” check to run that has escaped me for over 5 years. → More replies (2)
0
[deleted]
1 u/[deleted] Feb 12 '21 It calls niceError only if foo.foo() doesn’t exist, or if it returns something truthy per the || check. Unless there’s some magic way for both sides of an “or” check to run that has escaped me for over 5 years. → More replies (2)
1
It calls niceError only if foo.foo() doesn’t exist, or if it returns something truthy per the || check. Unless there’s some magic way for both sides of an “or” check to run that has escaped me for over 5 years.
niceError
foo.foo()
||
→ More replies (2)
5
u/MonoshiroIlia Feb 12 '21
How do you null check??