Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
enum CardinalDirections { North, East, South, West }; let currentDirection = CardinalDirections.North; // North is the first value so it logs '0' console.log(currentDirection); // throws error when commented in as 'North' is not a valid enum // currentDirection = 'North'; // Error: "North" is not assignable to type 'CardinalDirections'.
0