Pretty simple actually. It turns out that:
Why/when is this useful? Well, I found it using the regression-js package:
Suppose you have some constants, for the different regression types:
I originally had code in a
switch statement to tell me when to call which function:
With this little hack, I can reduce the
switch statement to one line:
Pretty neat, in my opinion.