Spread and destructuring can pull values out of iterable data.

Spread and Destructuring

spread.ts
const extraValue: number = ;
const source: number[] = [1, 2, extraValue];
const copy: number[] = [...source];
const [first, second, third] = copy;
const total: number = first + second + third;

console.log(`copy=${copy.join(",")}`);
console.log(`total=${total}`);
const extraValue: number = ;
const source: number[] = [1, 2, extraValue];
const copy: number[] = [...source];
const [first, second, third] = copy;
const total: number = first + second + third;

console.log(`copy=${copy.join(",")}`);
console.log(`total=${total}`);
const extraValue: number = ;
const source: number[] = [1, 2, extraValue];
const copy: number[] = [...source];
const [first, second, third] = copy;
const total: number = first + second + third;

console.log(`copy=${copy.join(",")}`);
console.log(`total=${total}`);
iterable spread The spread operator `...` copies values from an iterable into a new array or argument list.