In this blog post, a describe a little hack for quickly setting up constants (think enum values, but not wrapped inside a namespace). It is more an educational puzzle than something you should actually use in your code.
As an example, consider the following TypeScript enum (JavaScript itself does not have enums):
I usually prefer to use strings as enum values, because they are easier to debug:
You can achieve something similar in JavaScript as follows.
Read More