Skip to content

Commit 637ccab

Browse files
authored
Fix access method for house number in address object
Updated console log to access house number using array notation.
1 parent 9394322 commit 637ccab

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎Sprint-2/debug/address.js‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,4 @@ const address = {
1212
postcode: "XYZ 123",
1313
};
1414

15-
console.log(`My house number is ${address.houseNumber}`);
16-
17-
// "My house number is undefined"
18-
// The reason is that it is an object and not array
19-
// The correct statement is to use the dot operator to access the related field.
20-
// In this case, the property/field name should be houseNumber in the object address
15+
console.log(`My house number is ${address[0]}`);

0 commit comments

Comments
 (0)