Destructuring, rest, and spread
How many items does a contain?
Examples
Worked example
Input
const a = [1, 2]; const b = [...a, 3]
Expected output
2
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
Spread copies each entry into the new array b. It leaves array a as it was.