Javascript class for effortless enumeration