|
|
|
|
|
by pmontra
4018 days ago
|
|
It was an example of replacing constants with symbols when the value of the constant really doesn't matter. Purposely not fancy stuff. I understand the advantages of enums (among the others, their values are constrained) but does JS have enums? |
|
No, but TypeScript and Dart do.
Enums don't really work without types.
But using Symbols for fake enums is probably a good idea.
Slightly awkward, but this might be about as good as it gets.