Enum is a nice way to group a set of related constants together.
typescript
enum Direction {
Up,
Down,
Left,
Right,
}
let playerDirection: Direction = Direction.Up;
if (playerDirection === Direction.Up) {
console.log("Moving up!");
}You should see
Moving up!