TypeScript tutorialLesson 10Free preview
TS Enums
This lesson is part of TypeScript · All levels
Summary
Enum allows defining a set of named constants, such as a list of status or colors. By default the first member is 0 and then one is added, and the initial value can be changed as needed. TypeScript also provides enum and const enum strings that are inline during compilation.
Key points
- The default initial value of enum is 0.
- The enum can also contain the string value
- Const enum does not generate enum code in the compilation results
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.