Skip to content

Glasgow| 2026-ITP-Jan | Tuan Nguyen| Sprint 2 | Objects#1204

Open
Jacknguyen4438 wants to merge 12 commits intoCodeYourFuture:mainfrom
Jacknguyen4438:Sprint-2-Objects
Open

Glasgow| 2026-ITP-Jan | Tuan Nguyen| Sprint 2 | Objects#1204
Jacknguyen4438 wants to merge 12 commits intoCodeYourFuture:mainfrom
Jacknguyen4438:Sprint-2-Objects

Conversation

@Jacknguyen4438
Copy link
Copy Markdown

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

For this PR I have finish all the required section need for PR submission.

Questions

No question.

@Jacknguyen4438 Jacknguyen4438 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 Apr 18, 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.

Some of the code is not consistently formatted.

Have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode, as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
?

Comment thread Sprint-2/debug/author.js
Comment thread Sprint-2/debug/recipe.js Outdated
Comment thread Sprint-2/implement/contains.test.js Outdated
Comment thread Sprint-2/implement/tally.js
@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 Apr 18, 2026
@Jacknguyen4438
Copy link
Copy Markdown
Author

Jacknguyen4438 commented Apr 19, 2026

@cjyuan Hello and thank you for the feed back I have make some change base on your feed back the brand is ready for your review again. If you read this and see the tag not a course work, sorry for the mis leading tags due to the PR validation system keep reject my request for re-review by remove the need review tags

@Jacknguyen4438 Jacknguyen4438 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 19, 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 Apr 19, 2026
@Jacknguyen4438 Jacknguyen4438 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 19, 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 Apr 19, 2026
@Jacknguyen4438 Jacknguyen4438 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 Apr 19, 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 Apr 19, 2026
@github-actions

This comment has been minimized.

@Jacknguyen4438 Jacknguyen4438 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 19, 2026
@Jacknguyen4438 Jacknguyen4438 added the Submit:Issue This work is submitted by commenting on your copy of this Issue in your own fork of this module. label Apr 19, 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 Apr 19, 2026
@github-actions

This comment has been minimized.

@Jacknguyen4438 Jacknguyen4438 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Submit:Issue This work is submitted by commenting on your copy of this Issue in your own fork of this module. labels Apr 19, 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 Apr 19, 2026
@github-actions

This comment has been minimized.

@Jacknguyen4438 Jacknguyen4438 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. NotCoursework Not coursework - used for curriculum development work. labels Apr 19, 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 revert the change to Sprint-3/alarmclock/index.html on this branch to keep it clean.

Comment thread Sprint-2/implement/contains.js Outdated
Comment thread Sprint-2/implement/contains.js Outdated
Comment on lines +15 to +19
for (const item in object) {
if (Array.isArray(object[item])) {
return 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.

The function is supposed to check only if object is an object that is not an array, and whether the object has a property with the specified name. That is, the function should not need to check the property values.

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 your feed back. I have make some change to make sure the function operate what is suppose to do:

function contains(object, key) {
if (object === null ||typeof object !== "object" || Array.isArray(object)) {
return false;
}

if (Object.keys(object).length === 0) {
return false;
}

for (const item in object) {
if (item === key) {
return true;
}
}
return false;
}

Comment thread Sprint-2/implement/tally.js Outdated
Comment on lines +2 to +5
if (sumArray.length === 0) return {};
if (!Array.isArray(sumArray)) {
throw new Error("Input musk be an array");
}
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 sumArray is null or undefined, line 2 will cause an error to be thrown.

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 feed back here is my solution:

function tally(sumArray) {
if (!Array.isArray(sumArray)) {
throw new Error("Input musk be an array");
}

if (sumArray.length === 0) return {};

let totalSum = {};
for (const item of sumArray) {
if (!Object.hasOwn(totalSum, item)) {
totalSum[item] = 1;
} else {
totalSum[item] += 1;
}
}
return totalSum;
}

@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 Apr 19, 2026
@Jacknguyen4438
Copy link
Copy Markdown
Author

Hello @cjyuan I have make change and ready to be review again

@Jacknguyen4438 Jacknguyen4438 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed NotCoursework Not coursework - used for curriculum development work. labels Apr 19, 2026
@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented Apr 19, 2026

Looks good.

@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 Apr 19, 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