DEV Community

loading...

Discussion on: 5 ways to refactor if/else statements in JS functions

Collapse
abelardoit profile image
abelardoit • Edited

Hi there,

I would opt to reject any non-numeric value to compute any calculus.

If you provide a non-number to compute a sum, then the precondition is not valid; therefore, my function would throw an exception.

Nice article! Thanks for bring it us! Best regards.