This repository was archived by the owner on Jan 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathexercise-2.js
More file actions
45 lines (35 loc) · 1.21 KB
/
exercise-2.js
File metadata and controls
45 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
Given the same "house" object again
Follow the instructions below and then run the file
and make sure it outputs the correct results
*/
let house = {
address: "1 Kinning Park",
previousOwners: ["Claire M.", "John A."],
currentOwner: {
firstName: "Margaret",
lastName: "Conway"
}
};
let newCurrentOwner = {
firstName: "Georgina",
lastName: "Hernandez"
};
/*
DO NOT EDIT ANYTHING ABOVE THIS LINE
WRITE YOUR CODE BELOW
*/
// - assign the value of the variable 'newCurrentOwner' as the value to the house's "currentOwner"
house.currentOwner = newCurrentOwner;
// - from the list of previous owners, replace only "John A." with "Stephen B."
house.previousOwners[1] = 'Stephen B';
// - give the house a new property called 'isForSale' with the value 'false'
house.isForSale = false;
/*
DO NOT EDIT ANYTHING BELOW THIS LINE
*/
console.log(
"Did you correctly assign the new owner using the given variable?",
`Expected result: true. Actual result: ${(house.currentOwner === newCurrentOwner)}`);
console.log(`Expected result: Claire M., Stephen B.Actual result: ${house.previousOwners.toString()}`);
console.log(`Expected result: false.Actual result: ${house.isForSale}`);