Enums allow you to define a set of named constants for cleaner code.
enum Color {
Red = "red",
Green = "green",
Blue = "blue"
}
let color1: Color = Color.Red;
console.log(color1); // Output: red
// The following assignment would trigger a compile error:
// let color2: Color = "red"; // Error: Type '"red"' is not assignable to type 'Color'