Assume we have function that returns array let's say
fn(parm1, parm2, parm3)
and i want to conditional reverse the returned array.
I know you can do something like this:
condition ? fn(parm1, parm2, parm3).reverse() : fn(parm1, parm2, parm3)
But in my case I don't want to call it twice. Not the array or even the function that calls the array.
So my question, is there something obvious to do and I've missed like
array[condition && .reverse()]
or the first way is the only way to call array methods.