You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b057112
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-2/debug/address.js
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,19 @@
4
4
// but it isn't working...
5
5
// Fix anything that isn't working
6
6
7
+
/*const address = {
8
+
houseNumber: 42,
9
+
street: "Imaginary Road",
10
+
city: "Manchester",
11
+
country: "England",
12
+
postcode: "XYZ 123",
13
+
};
14
+
15
+
console.log(`My house number is ${address[0]}`); */
16
+
17
+
// The line "address[0]" is wrong. Because address is an object not an array, so "address[0]" is undefined. The output will be "My house number is undefined".
18
+
19
+
// Corrected code
7
20
constaddress={
8
21
houseNumber: 42,
9
22
street: "Imaginary Road",
@@ -12,4 +25,4 @@ const address = {
12
25
postcode: "XYZ 123",
13
26
};
14
27
15
-
console.log(`My house number is ${address[0]}`);
28
+
console.log(`My house number is ${address.houseNumber}`);
0 commit comments