1enum AnEnum {
2 One = 1,
3 Two = 2
4}
5let stringOne = AnEnum[1]; // "One"
6let stringTwo = AnEnum[AnEnum.Two]; // "Two"
1enum Response {
2 No = 0,
3 Yes = 1,
4}
5
6function respond(recipient: string, message: Response): void {
7 // ...
8}
9
10respond("Princess Caroline", Response.Yes)
11