My favorite alternative to JavaScript’s switch statement
The post argues that JavaScript switch statements become cumbersome, and shows how object literals and first-class functions can replace them with code that is more modular and easier to extend.