3 ms·
>At least in javascript it's easier with the && operator: str && str.doSomething() Mixing a Boolean check and a potentially side effecting function in the same
by jaxytee 13y ago
>At least in javascript it's easier with the && operator:
str && str.doSomething()
Mixing a Boolean check and a potentially side effecting function in the same line of code is a neat hack, but it seems like it would make code harder to maintain. Also, what about handling the non existence of str?