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

London8 Daniel Piga Core2 week1 - #3

Closed
pigos4 wants to merge 1 commit into
CodeYourFuture:mainfrom
pigos4:main
Closed

London8 Daniel Piga Core2 week1#3
pigos4 wants to merge 1 commit into
CodeYourFuture:mainfrom
pigos4:main

Conversation

@pigos4

@pigos4 pigos4 commented Jan 22, 2022

Copy link
Copy Markdown

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
},
};
for (let recipe in recipes){
console.log(recipes[recipe].title);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You use recipes[recipe] multiple times. I usually suggest introducing a variable to reduce code duplication. But in this case - would for-of loop work better?

function createShoppingList(recipe) {
// write code here
function createShoppingList({ name, ingredients }) {
const { cupboardContents,fridgeContents} = pantry;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

falafel: 7.25,
};

const order = (price) => (balance) =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very good - functions that produce functions is an important mental shift. That's a very powerful technique. Don't overuse it though :)

Comment thread 3-extra/1-count-words.js
// write code here

return wordCount;
return (string ? string.split(" ") : []).reduce(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a decent implementation and you used quite a few tricks here. However, I ague that you need to look for simpler (more readable) solutions:

function countWords(string) {
  const wordCount = {};
  const words = string ? string.split(" ") : []
  for (const word of words) {
    wordCount[word] = 1 + (wordCount[word] || 0)
  }
  return wordCount
}

@kolomiets kolomiets added the reviewed A mentor has reviewed this code label Jan 29, 2022
@github-actions

Copy link
Copy Markdown

Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback.

@github-actions github-actions Bot added the Stale label Mar 13, 2022
@github-actions github-actions Bot closed this Mar 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

reviewed A mentor has reviewed this code Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants