|
|
|
|
|
by gtsop
1125 days ago
|
|
We are being quite abstract here since we are lacking real-life examples here, but using a variabe assignment intead of an inline if/else assertion does not add any complexity at all. It adds more code, yes. More complexity? No. Is it good or bad to add more code? I would answer: the more easily readable and maintainable version of the code is the better version of the code. More times than not, more code is the better version (when it is dry, with correct abstractions and good names). |
|
Personally, most of the time I assign to a variable. But I do think there are cases where the IIFE is an appropriate and more elegant approach.