Skip to content

Commit e1d8a8b

Browse files
committed
Made changes as requested by mentor in the PR request reviews.
1 parent f5389fa commit e1d8a8b

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Sprint-2/debug/address.js

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

15-
console.log(`My house number is ${address.houseNumber}`); // Objects are accessed using dot notation or string keys. Example address.houseNumber
15+
console.log(`My house number is ${address.houseNumber ?? "unknown"}`); // Objects are accessed using dot notation or string keys. Example address.houseNumber

Sprint-2/debug/recipe.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ const recipe = {
1010
ingredients: ["olive oil", "tomatoes", "salt", "pepper"],
1111
};
1212

13-
console.log(`${recipe.title} serves ${recipe.serves}
14-
ingredients:
15-
${recipe.ingredients.join("\n")}`);
13+
console.log(`${recipe.title} serves ${recipe.serves}`);
14+
console.log("ingredients:");
15+
16+
// Check if ingredients is an array
17+
if (Array.isArray(recipe.ingredients)) {
18+
console.log(recipe.ingredients.join("\n"));
19+
} else {
20+
console.log("No valid ingredient list available.");
21+
}

Sprint-2/implement/contains.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function contains(object, propertyName) {
2-
if (typeof object === "object" && object !== null) {
2+
if (typeof object === "object" && object !== null && !Array.isArray(object)) {
33
return propertyName in object;
44
}
55
return false;

0 commit comments

Comments
 (0)