Skip to content

London | 26-ITP-May | Russom Gebremeskel | Sprint 2 | Coursework - #1351

Open
russom-g wants to merge 29 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2
Open

London | 26-ITP-May | Russom Gebremeskel | Sprint 2 | Coursework#1351
russom-g wants to merge 29 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2

Conversation

@russom-g

@russom-g russom-g commented Jul 31, 2026

Copy link
Copy Markdown
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

An implementation fixed. A test created to prove the function works as required.

russom added 26 commits July 16, 2026 20:57
@github-actions

This comment has been minimized.

@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
Comment thread Sprint-2/debug/recipe.js
Comment on lines +15 to +18
${recipe.ingredients[0]}
${recipe.ingredients[1]}
${recipe.ingredients[2]}
${recipe.ingredients[3]}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you rewrite the code so that it works for any number of ingredients?

@@ -1,3 +1,10 @@
function contains() {}
function contains(object, property) {
for (let key in object) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Normally, when we use for...in or for...of loops, we don't need to modify the loop variable within the loop. As a result, a common practice is to declare the loop variable using const.

Comment on lines 47 to +52
// Given invalid parameters like an array
// When passed to contains
// Then it should return false or throw an error
test("contain on invalid parameters returns false", function () {
expect(contains([], "0")).toBe(false);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you check if contains(['a', 'b', 'c'], "0") return the value you expect?

if (!Array.isArray(arr)) {
throw new Error("Invalid input");
}
const count = {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does the following function call returns the value you expect?

tally(["toString", "toString"]);

Suggestion:

  • Look up an approach to create an empty object with no inherited properties, or
  • use Object.hasOwn()

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants