Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Destructuring worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1let [a, b] = [1, 2]; | A[x, y] = [5, 6] | |
| 2let {name, age} = person; | B{city, zip} = place | |
| 3Unpacks values from an array by their position | CUnpacks the array into two separate variables a and b | |
| 4Unpacks properties from an object into matching variables | DUnpacks the name and age properties into variables | |
| 5let (a, b) = [1, 2]; | EWrong - array destructuring uses [], not () | |
| 6let (name, age) = person; | FWrong - object destructuring uses {}, not () |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
destructuring — Unpacks values from an array or properties from an object into separate variables.let [a, b] = [1, 2];let [i, j] = [3, 4];let {name, age} = person;let {name, age} = person;let [x, y] = [5, 6];