⊗jstsPmEnEK 32 of 55 menu

Explicit Enum Keys in TypeScript

The numbering of keys in enumerations does not necessarily have to start from zero. You can specify keys explicitly as follows:

enum Season { Winter = 1, Spring = 2, Summer = 3, Autumn = 4 };

Let's check:

let current: Season = Season.Winter; console.log(current); // will output 1

Make an enumeration Months and assign numbers to all months of the year. Output the first and fifth months to the console.

enru