String Enum
Question
What is a string enum?
Hint
String enums do not have reverse mappings.
Explanation
A string enum has string values for each member: enum Direction { Up = "UP", Down = "DOWN" }. String enums are more self-documenting than numeric enums (the value is visible in compiled JS). They do not create reverse mappings. String enums are useful for configuration, status values, and serialization. However, union types of string literals ("UP" | "DOWN") are often preferred as they are lighter and work better with type narrowing.
Related Resources
Related Lessons
- Enums
Learn enums.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.