Deviopath › TypeScript

Move on a Grid

Easy · Literal Types

Create a type Direction = "up" | "down" | "left" | "right".

Write move(pos: Point, dir: Direction): Point that returns a new point moved one step. "up" increases y, "right" increases x. Do not change the original object.

Next: Active Users Only