Skip to content

Commit 9dff4c0

Browse files
authored
Merge pull request javascript-tutorial#870 from gargakshat/patch-1
Update to improve clarity and avoid confusion.
2 parents 3dbe87a + db55cf7 commit 9dff4c0

File tree

1 file changed

+4
-4
lines changed
  • 1-js/05-data-types/09-destructuring-assignment

1 file changed

+4
-4
lines changed

1-js/05-data-types/09-destructuring-assignment/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ let surname = arr[1];
4242
```
4343
````
4444

45-
````smart header="Ignore first elements"
45+
````smart header="Ignore elements using commas"
4646
Unwanted elements of the array can also be thrown away via an extra comma:
4747
4848
```js run
4949
*!*
50-
// first and second elements are not needed
51-
let [, , title] = ["Julius", "Caesar", "Consul", "of the Roman Republic"];
50+
// second and forth elements are not needed
51+
let [firstName, , title] = ["Julius", "Caesar", "Consul", "of the Roman Republic"];
5252
*/!*
5353
5454
alert( title ); // Consul
5555
```
5656
57-
In the code above, although the first and second elements of the array are skipped, the third one is assigned to `title`, and the rest are also skipped.
57+
In the code above, although thesecond elements of the array is skipped, the third one is assigned to `title`, and the rest are also skipped.
5858
````
5959

6060
````smart header="Works with any iterable on the right-side"

0 commit comments

Comments
 (0)