Skip to content

West Midlands | ITP-MAY25 | Saleh Yousef | Module-Data-Groups | Sprint-2 #622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sprint-2/debug/address.js
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// but it isn't working...
// Fix anything that isn't working

// I Think the issue isin the console.log statement. i will fix it buy using dot notation to access the houseNumber property of the address object.
// It is trying to access the houseNumber using an index, but it should use the property houseNumber.
const address = {
houseNumber: 42,
street: "Imaginary Road",
Expand All @@ -12,4 +14,4 @@ const address = {
postcode: "XYZ 123",
};

console.log(`My house number is ${address[0]}`);
console.log(`My house number is ${address.houseNumber}`);
4 changes: 2 additions & 2 deletions Sprint-2/debug/author.js
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Predict and explain first...
// Predict and explain first... It won't work because the method `for...of` is used for iterable objects like arrays.

// This program attempts to log out all the property values in the object.
// But it isn't working. Explain why first and then fix the problem
Expand All @@ -11,6 +11,6 @@ const author = {
alive: true,
};

for (const value of author) {
for (const value of Object.values(author)) {
console.log(value);
}
8 changes: 5 additions & 3 deletions Sprint-2/debug/recipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Predict and explain first...
// Predict and explain first... it won't work because the ingredients are not being accessed correctly.

// This program should log out the title, how many it serves and the ingredients.
// Each ingredient should be logged on a new line
Expand All @@ -11,5 +11,7 @@ const recipe = {
};

console.log(`${recipe.title} serves ${recipe.serves}
ingredients:
${recipe}`);
ingredients:`);
recipe.ingredients.forEach((ingredient) => {
console.log(ingredient);
});