Skip to content

Conversation

@Alaa-Tagi
Copy link

Learners, PR Template

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

I have completed the tasks required in this sprint.

Questions

No questions.

@Alaa-Tagi Alaa-Tagi added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Nov 24, 2025
Comment on lines +30 to +45
function countWords(inputString) {

const cleanedString = inputString.replace(/[.,!?]/g, '').toLowerCase();
const wordsArray = cleanedString.split(/\s+/);
const wordCount = {};

for (const word of wordsArray) {
if (wordCount[word] === undefined) {
wordCount[word] = 1;
} else {
wordCount[word]++;
}
}

return wordCount;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Change is optional.

Here are some test cases you can try when you have time.

countWords("constructor constructor");
countWords("          Hello    World      ");

Comment on lines +62 to +86
test("totalTill calculates the total amount in pounds from the till object", () => {
const till = {
"1p": 10,
"5p": 6,
"50p": 4,
"20p": 10,
};

expect(totalTill(till)).toBe("£4.10");
});

// Additional test cases
test("totalTill returns £0.00 for an empty till", () => {
const till = {};

expect(totalTill(till)).toBe("£0.00");
});

test("totalTill handles tills with only one type of coin", () => {
const till = {
"100p": 5,
};

// d) Write a test for this function to check it works and then fix the implementation of totalTill
expect(totalTill(till)).toBe("£5.00");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can your function pass all these tests?

@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 Nov 25, 2025
@Alaa-Tagi Alaa-Tagi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 26, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes are good.

It's best practice to also respond to each of reviewer's comments.

Comment on lines +17 to +19
recipe.ingredients.forEach(ingredient => {
console.log(ingredient);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

This work. Could also explore Array.prototype.join().

Comment on lines +22 to 31
if (firstEq === -1) {
// No "=" found → key with empty value
key = decodeURIComponent(pair);
value = "";
} else {
key = decodeURIComponent(pair.slice(0, firstEq));
value = decodeURIComponent(pair.slice(firstEq + 1));
}

queryParams[key] = value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also consider performing the decoding step on line 31.

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 27, 2025
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