-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise-1.js
More file actions
63 lines (52 loc) · 1.33 KB
/
exercise-1.js
File metadata and controls
63 lines (52 loc) · 1.33 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Given the same "house" object again
Write the code for the functions as per the description above them
*/
let kinningParkHouse = {
address: "1 Kinning Park",
price: 180000,
currentOwner: {
firstName: "Margaret",
lastName: "Conway",
email: "margaret@fake-emails.com",
},
};
let parkAvenueHouse = {
address: "50 Park Avenue",
price: 195000,
currentOwner: {
firstName: "Marie",
lastName: "McDonald",
email: "marie.m@real-emails.com",
},
};
/*
DO NOT EDIT ANYTHING ABOVE THIS LINE
WRITE YOUR CODE BELOW
*/
// returns the full name (first name + last name) of the owner of the house
function getOwnerFullName(house) {}
// returns an array of the owners' email addresses of the two houses
function getEmailAddresses(house1, house2) {}
// returns the address for the cheapest house out of the two
function getCheapestAddress(house1, house2) {}
/*
DO NOT EDIT ANYTHING BELOW THIS LINE
*/
console.log(
`Expected result: Margaret Conway. Actual result: ${getOwnerFullName(
kinningParkHouse
)}`
);
console.log(
`Expected result: margaret@fake-emails.com, marie.m@real-emails.com. Actual result: ${getEmailAddresses(
kinningParkHouse,
parkAvenueHouse
)}`
);
console.log(
`Expected result: 1 Kinning Park. Actual result: ${getCheapestAddress(
parkAvenueHouse,
kinningParkHouse
)}`
);