Skip to content

London |ITP-Jan-2016 | Ping Wang | Sprint 2 |Coursework#1023

Open
pathywang wants to merge 11 commits intoCodeYourFuture:mainfrom
pathywang:sprint-2
Open

London |ITP-Jan-2016 | Ping Wang | Sprint 2 |Coursework#1023
pathywang wants to merge 11 commits intoCodeYourFuture:mainfrom
pathywang:sprint-2

Conversation

@pathywang
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

i did coursework with node or npm jest to check my work to make sure that my code works as expected after i completed my prep

@pathywang pathywang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 17, 2026
Comment thread Sprint-2/debug/recipe.js Outdated
Comment thread Sprint-2/implement/contains.test.js Outdated
Comment thread Sprint-2/implement/lookup.js
Comment thread Sprint-2/implement/lookup.test.js Outdated
Comment thread Sprint-2/implement/querystring.js
Comment thread Sprint-2/implement/tally.js Outdated
Comment on lines +2 to +16
if (!Array.isArray(array)) {
throw new Error("Invalid input: expected an array");
}

const count={}
for(item of array){
if (count[item]){
count[item] += 1
}
else{
count[item] = 1
}
}
return 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.

  • Can you improve the indentation?

  • 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.

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.

Thank you for the suggestion. It is the first time i hear the empty object with no inherited properties. i went to AI help who explained to me about the advantage of no inherited properties. i am trying to practice with my code from now on.

@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 Mar 21, 2026
@pathywang pathywang 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 Mar 22, 2026
Copy link
Copy Markdown
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.

Please note that in CYF courses, the recommended way to inform the reviewer of your changes is to do both of the following:

  • Reply to their feedback.
    • In the responses, clarify how each piece of feedback was addressed to demonstrate that you've carefully reviewed the suggestions.
      • You may find the suggestions in this PR Guide useful.
    • Your response may trigger a notification (depending on the reviewer's settings), helping ensure they’re aware of the updates you’ve made.
  • Replace the "Reviewed" label by a "Needs review" label (which you have done -- great!)
    • Without this label, the reviewer would not know if your changes is ready to be reviewed.

Comment thread Sprint-2/implement/tally.js Outdated
Comment on lines +2 to +17
if (!Array.isArray(array)) {
throw new Error("Invalid input: expected an array");
}

const count = Object.create(null);

for (const item of array) {
if (count[item]) {
count[item] += 1;
} else {
count[item] = 1;
}
}

return 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.

Code is not yet properly indented. Can you fix the identation?

If you have enabled "Format on save" but it is not working, it is likely that you haven't assign a formatter for JS file. This could happen if you have zero or multiple extensions that can format .js file.

If you have installed "Prettier" extension. To assign it as the formatter of JS code, you can try:

  1. Use "Format document" to format the JS file. Sometimes, VSCode will ask you to choose a formatter, and you can manually select "Prettier".
  2. Edit settings.json and set Prettier as the default formatter for JS.
    See: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

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.

sorry sometimes i forgot about indention syntax because i pay more attention on node running, the rule is about 2 standard space for indentation and allign the parallel function

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 would put comment on after i correct my code according PR guide which give me another chance to review correction. What is more, i know what is the reason for correction later on.

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.

If you have successfully enabled "Format on save" and assign "Prettier" as your JS code formatter on VSCode, you won't have to worry about indentation and code format anymore.

@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 Mar 22, 2026
@pathywang pathywang 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 Mar 22, 2026
@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented Mar 22, 2026

Changes look good. Well done.

@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 Mar 22, 2026
@pathywang
Copy link
Copy Markdown
Author

pathywang commented Mar 22, 2026 via email

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants