Removing conditionals can sometimes reduce complexity. However, the benefits aren't so obvious in this example. We'll replace a conditional five times, each using a different language feature, and see how it impacts the understandability of the code.

Execute Program

Looking for something more interactive? Try Execute Program, an interactive learning platform from Destroy All Software LLC! It has courses on TypeScript, SQL, regular expressions, JavaScript concurrency, and more. All Destroy All Software subscriptions include full access to Execute Program, or you can subscribe to Execute Program directly.