Tuples & labeled tuples
Learn about tuples: arrays with fixed length and known element types. Discover labeled tuples for readability.
Intro
Goal: Learn how tuples differ from arrays. They have fixed length and element types, and can be labeled for clarity.
Simple tuple
A tuple defines specific element types at each position, unlike arrays where all elements share a type.
let point: [number, number] = [10, 20];
console.log(point[0], point[1]);All lessons in this course
- Arrays & ReadonlyArray
- Tuples & labeled tuples
- Enums vs const enum vs union-literal alternatives