Working with Enums in TypeScript
Explore how TypeScript enums can be used to represent a set of named constants, making your code more readable and self-explanatory.
Explore how TypeScript enums can be used to represent a set of named constants, making your code more readable and self-explanatory.
enum Color {
Red,
Green,
Blue,
}
const selectedColor: Color = Color.Red;
if (selectedColor === Color.Red) {
console.log("Selected color is Red");
}