Skip to content

Commit 35fceee

Browse files
authored
Fix console log to access houseNumber in address object
Updated console log to correctly access houseNumber property.
1 parent 4222cda commit 35fceee

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Sprint-2/debug/address.js‎

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

15-
console.log(`My house number is ${address[0]}`);
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

0 commit comments

Comments
 (0)