enum Weather {
Sunny,
Cloudy,
Rainy,
Snowy
}
let today: Weather = Weather.Cloudy;
let tomorrow: Weather = 200;
console.log("Today value", today); // Today value 1
console.log("Today key", Weather[today]); // Today key Cloudy
enum Weather1 {
Sunny = 100,
Cloudy,
Rainy = 200,
Snowy
}
/*
var Weather;
(function (Weather) {
Weather[Weather["Sunny"] = 0] = "Sunny";
Weather[Weather["Cloudy"] = 1] = "Cloudy";
Weather[Weather["Rainy"] = 2] = "Rainy";
Weather[Weather["Snowy"] = 3] = "Snowy";
})(Weather || (Weather = {}));
var today = Weather.Cloudy;
var tomorrow = 200;
console.log("Today value", today); // Today value Cloud
console.log("Today key", Weather[today]); // Today key undefined
*/