← All Exercises
Tuple Type Operations
basictypescript
Background
Tuples enforce both the length and the type at each position of an array, useful for coordinate pairs and CSV row data.
Problem
Write a TypeScript function that takes a tuple [string, number] representing a name and age, and returns a formatted string.
Input
A tuple of type [string, number].
Output
A formatted string combining the tuple elements.
Sample tests
Sample 1
Input: ["Alice", 30]
Expected: "Alice is 30"
Your solution
Learning objective
Learn tuple types for fixed-length, fixed-type arrays and destructuring.