⊗jstsPmEnSK 33 of 55 menu

Simplified Keys in TypeScript

It is not necessary to specify keys for all elements. It is enough to specify it for the first element and the keys of the following elements will increase in order. Example:

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

Let's check:

let current: Season = Season.Summer; console.log(current); // will output 3

Tell me what the result of running the following code will be:

enum Fruits { Apples = 1, Bananas, Oranges, Grapes }; let myFruit: Fruits = Fruits.Grapes; console.log(myFruit);
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