Skip to content

London | 26-ITP-May | Damilola Odumosu | Sprint 2 | Coursework - #1352

Open
d-odumosu wants to merge 20 commits into
CodeYourFuture:mainfrom
d-odumosu:coursework/sprint-2
Open

London | 26-ITP-May | Damilola Odumosu | Sprint 2 | Coursework#1352
d-odumosu wants to merge 20 commits into
CodeYourFuture:mainfrom
d-odumosu:coursework/sprint-2

Conversation

@d-odumosu

Copy link
Copy Markdown

Self checklist

  • 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

Changelist

  • debug
  • implement
  • interpret

@d-odumosu d-odumosu added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. 📅 Sprint 2 Assigned during Sprint 2 of this module labels Jul 31, 2026
Comment thread Sprint-2/debug/author.js Outdated
Comment thread Sprint-2/debug/recipe.js Outdated
Comment thread Sprint-2/implement/contains.js Outdated
Comment thread Sprint-2/implement/contains.js Outdated
Comment thread Sprint-2/implement/contains.test.js Outdated
Comment thread Sprint-2/implement/querystring.test.js
Comment thread Sprint-2/implement/querystring.js
Comment thread Sprint-2/implement/tally.js Outdated
@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

@cjyuan cjyuan left a comment

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 also address the two comments related to querystring.js in the previous review?

Comment thread Sprint-2/debug/author.js Outdated
for (const value of author) {
console.log(value);
//An object is not directly iterable, if we want to log out the values we can use a for in loop
for (const value in author) {

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.

The value in the loop is actually the key or property of the object. Naming it value is a bit misleading.

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.

changed the variable name to key, thank you

Comment thread Sprint-2/implement/contains.js Outdated
Comment on lines +2 to +8
if (!(
typeof object === "object" &&
!Array.isArray(object) &&
object !== null
)) {
throw new Error("Invalid data type");
}

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.

Double negatives makes the condition harder to read.

Suggestion: Look up "How De Morgan's Law works in programming?" and apply it to transform the condition.

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 made this changes

Comment thread Sprint-2/implement/contains.test.js Outdated
Comment on lines +76 to +83
test.each([["hello"], [123], [true], [[]], [null]])(
"throws an error when input is %p",
(type) => {
expect(() => {
contains(type, "A");
}).toThrow("Invalid data type");
}
);

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.

The forth test data is also an array, do you mean to test undefined?

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 was initially testing an empty array but per your suggestions i have made a different test to test non empty arrays and i have changed this to test undefined

Comment thread Sprint-2/implement/contains.test.js Outdated
Comment on lines +60 to +68
const obj3 = {
title: "Things fall apart",
year: 1958,
publisher: "pan-macmillan",
};
const propertyNameCheck3 = "location";
const expected3 = false;
const result3 = contains(obj3, propertyNameCheck3);
expect(result3).toBe(expected3);

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.

Is it necessary to add a suffix 3 to the names of these local variables?

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.

It is'nt, the variables are in different scopes, i have removed the suffixes

@d-odumosu d-odumosu added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 13, 2026
@d-odumosu

Copy link
Copy Markdown
Author

Could you also address the two comments related to querystring.js in the previous review?

I think i have fixed all suggested changes

@cjyuan cjyuan left a comment

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.

Changes look good.

Comment on lines +12 to +14
if (pair.includes("+")) {
pair = pair.replaceAll("+", " ");
}

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 also just call .replaceAll() without the if statement.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Data-Groups The name of the module. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants