Switch Kicker
by in CodeSOD on 2022-02-28As covered previously, game code generally doesn't represent an interesting WTF. But bad e-commerce code certainly does. So today, Rhys sends us some JavaScript from a web-based fantasy-football (for non-USA values of football) site. Given that it handles microtransactions and in-game items passed between players, it's definitely more on the e-commerce side of things than anything else.
And much like that previous article, this one does involve a very large switch, but before we get to the switch, we have to get to the state validator: