Deviopath › TypeScript

Swap a Tuple

Easy · Arrays & Tuples

A tuple is an array with a fixed length and a known type at each position.

Write swap<A, B>(pair: [A, B]): [B, A] that returns a new tuple with the two items swapped.

Next: Tuple to Sentence