Thuta Learning
IntermediateProgrammingintermediate

Enums

Relax. We'll talk through this in plain words — no textbook voice.

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!