Array and Tuple Destructuring
Destructure arrays and tuples with correct element types.
Positional Destructuring
Array destructuring binds variables by position rather than by name. With tuples, each position carries a specific type, giving you precise, ordered extraction.
Basic Array Destructuring
Square brackets on the left pull elements out by index order. For a plain array, every binding shares the array's element type.
const nums = [10, 20, 30]
const [first, second] = nums
console.log(first + second) // 30All lessons in this course
- Object Destructuring Types
- Array and Tuple Destructuring
- Default Values in Destructuring
- Nested Destructuring Patterns