Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

WM4 - Robert Csonka - JavaScript-Core2-Week1#79

Open
RobCso wants to merge 3 commits into
CodeYourFuture:mainfrom
RobCso:main
Open

WM4 - Robert Csonka - JavaScript-Core2-Week1#79
RobCso wants to merge 3 commits into
CodeYourFuture:mainfrom
RobCso:main

Conversation

@RobCso
Copy link
Copy Markdown

@RobCso RobCso commented Sep 13, 2022

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

Comment thread 2-mandatory/1-recipes.js
console.log("Serves: " + recipe5.Serves)
console.log("Ingredients:")
recipe5.Ingredients.forEach(ingredient=>console.log(ingredient))
console.log("") No newline at end of file
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Used a similar approach

});
return currencyCodesObject;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have used the forEach method to loop though the aray, the solution used a for of loop

let list = recipe.ingredients.filter(ingredient => !combinedPantry.includes(ingredient))
return {name : recipe.name, items: list}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In my solution I have joined the 2 arrays first before filtering through them

} else return balance;
}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have used a similar approach with small differences, the example has declared a variable isBalanceBigEnough that calculates the balance and passes the variable into the if statement, I have passed the calculation into the if statement without assigning it to a variable

Comment thread 3-extra/1-count-words.js
})}
return wordCount;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have used a simple comparison to compare and count words inside a forEach method

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant