I'd prefer a ternary over the if-else, but changing the tests to a list of functions is excellent. Adding, updating, removing tests becomes dead simple at this point and it's easier to test.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'd prefer a ternary over the if-else, but changing the tests to a list of functions is excellent. Adding, updating, removing tests becomes dead simple at this point and it's easier to test.