String Enum Value
Predict Output Easy
Question
What does this code print?
Code
enum Dir { Up = "UP", Down = "DOWN" }
console.log(Dir.Up);
Hint
String enum members have their string values.
Explanation
Dir.Up is "UP" and Dir.Down is "DOWN". String enums do not auto-increment — each member must have an explicit string value.
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.