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 | |
|---|---|---|
| 1rex.age | Aconsole.log(rex.name); | |
| 2rex.age = 4; | BReads the age property of the object stored in rex | |
| 3Print the value of a property stored in an object called rex | CBrackets are used instead of a dot. It should be rex.age to read the property. | |
| 4Changing one object's property does not change another object's copy | DChanges rex's age property to the new value 4 | |
| 5rex.age == 4; | E== compares values instead of assigning. It should be rex.age = 4; to change the property. | |
| 6console.log(rex(age)); | Frex.age = 4; console.log(milo.age); |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
object.property — Reads a property of an object, like rex.age. To change it, assign a new value: rex.age = 4. Each object keeps its own values.const rex = new Dog("Rex", 3);
console.log(rex.age);const rex = new Dog("Rex", 3);
rex.age = 4;
console.log(rex.age);const rex = new Dog("Rex", 3);
const mia = new Dog("Mia", 5);
mia.age = 6; // rex.age is still 3const rex = new Dog("Rex", 3);
rex.age = rex.age + 1;
console.log(rex.age); // 4const rex = new Dog("Rex", 3);
rex.age = 4; // Rex is now 4 years old
console.log(rex.age);