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:
typescriptenum Season { Winter = 1, Spring, Summer, Autumn };
Let's check:
typescriptlet current: Season = Season.Summer;
console.log(current); // will output 3
Задание 1
Tell me what the result of running the following code will be:
typescriptenum Fruits { Apples = 1, Bananas, Oranges, Grapes };
let myFruit: Fruits = Fruits.Grapes;
console.log(myFruit);