DEV Community

Discussion on: Daily Challenge #266 - Who Likes It?

Collapse
 
functional_js profile image
Functional Javascript

The exception would be if the more "complex" solution was more performant.

For verification, I ran a perf test on the two funcs, and the switch idiom won out. (see screenshot below).

If another idiom were to beat out the switch idiom, I would swap out the implementation for the fastest idiom that uses the least cycles.
Wrap it in a function, document it, and include a resource link to the performance notes, tests and reasoning of the chosen implementation.

Alt Text