Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
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 | |
|---|---|---|
| 1student.age = 16; | Aconsole.log(student.email); // undefined | |
| 2student.house = "Red"; | Bstudent.points = 50; | |
| 3Reading a property that was never added gives undefined | CChanges the existing age property of student to 16 | |
| 4Use dot notation and = to give an object a new property | DAdds a new house property to student if it was not there before | |
| 5student.age == 16; | E== compares values instead of assigning. It does not change age. Use a single = to assign. | |
| 6student = 16; | FThis assigns to the whole variable, not the age property. It should be student.age = 16; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
student.age = 16 — Assigning to object.property with = changes an existing property or adds a new one if it is not there yet. Reading a property that does not exist gives undefined.let student = { name: "Ava", age: 15 };
student.age = 16;
console.log(student.age);let student = { name: "Ava", age: 15 };
student.age = 16;
console.log(student.age);let student = { name: "Ava" };
student.age = 16;
console.log(student.age);let student = { name: "Ava" };
console.log(student.age);
// prints undefinedlet student = { name: "Ava", age: 15 };
student.age += 1;
// age is now 16