Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Nested Arrays and Objects 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 | |
|---|---|---|
| 1obj.pets[0] | AAccesses the city property nested inside addr inside obj | |
| 2obj.addr.city | BWrong - a nested property needs a dot, not unquoted brackets | |
| 3Accesses an element in a 2D array using two indexes | Cusers[0].name | |
| 4Accesses a property on an object stored inside an array | DWrong - array indexes use brackets, not dots | |
| 5users.0.name | Egrid[0][1] | |
| 6obj.addr[city] | FAccesses the first element of the pets array inside obj |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
obj.pets[0] — Chains dot notation and bracket notation to access a value nested inside an object.console.log(person.pets[0]);console.log(obj.addr.city);console.log(users[0].name);console.log(data.scores[2]);console.log(grid[0][1]);