⊗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.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline