In this blog post, I present enumify, a library for implementing enums in JavaScript. The approach it takes is inspired by Java’s enums. Enum patterns # The following is a naive enum pattern for JavaScript: const Color = { RED: 0, GREEN: 1, BLUE: 2, } This implementation has several problems: Logging: If you log an enum value such as Color.RED, you don’t see its name. Type safety: Enum values are