Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created October 28, 2018 02:01
Show Gist options
  • Save tkssharma/c2edc77e8ff4063a38771402661cd0e7 to your computer and use it in GitHub Desktop.
Save tkssharma/c2edc77e8ff4063a38771402661cd0e7 to your computer and use it in GitHub Desktop.
enum Weather {
Sunny,
Cloudy,
Rainy,
Snowy
}
let today: Weather = Weather.Cloudy;
let tomorrow: Weather = 200;
console.log("Today value", today); // Today value Cloud
console.log("Today key", Weather[today]); // Today key undefined
enum Weather1 {
Sunny = 100,
Cloudy,
Rainy = 200,
Snowy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment