Skip to content

Commit 240109b

Browse files
committed
Merge pull request nzakas#194 from hallaji/patch-1
Fix typo in Destructuring chapter
2 parents 5808840 + 216093f commit 240109b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

manuscript/05-Destructuring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ let [ firstColor, ...restColors ] = colors;
356356
console.log(firstColor); // "red"
357357
console.log(restColors.length); // 2
358358
console.log(restColors[0]); // "green"
359-
console.log(restColors[0]); // "blue"
359+
console.log(restColors[1]); // "blue"
360360
```
361361

362362
In this code, the first item in `colors` in assigned to `firstColor`, and the rest are assigned into a new array in `restColors`. The `restColors` array, therefore, has two items: `"green"` and `"blue"`. Rest items are useful for extracting certain items from an array and keeping the rest available, but there's also another helpful use.

0 commit comments

Comments
 (0)