Using the Switch(true) Pattern in JavaScript – Blog by Seán Barry

The switch true pattern isn’t well known but it is incredibly useful. It’s not a JavaScript specific pattern, but I use it in almost every single project.