Skip to content

Glasgow | 26-ITP-May | Sandani Kannangara | sprint 1 | Data groups#1233

Open
SandzSoft wants to merge 9 commits into
CodeYourFuture:mainfrom
SandzSoft:data-groups/sprint-1
Open

Glasgow | 26-ITP-May | Sandani Kannangara | sprint 1 | Data groups#1233
SandzSoft wants to merge 9 commits into
CodeYourFuture:mainfrom
SandzSoft:data-groups/sprint-1

Conversation

@SandzSoft

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

This PR implements solutions for Sprint 1 data group exercises, including dedupe, findMax, and sum functions. It also includes Jest tests for each function, covering basic cases, duplicates handling, and edge cases such as empty arrays and non-numeric values.

@github-actions

This comment has been minimized.

@SandzSoft SandzSoft changed the title Glasgow | 26-ITP-May | Sandani Kannangara | Data groups | sprint 1 Glasgow | 26-ITP-May | Sandani Kannangara | Data groups/sprint 1 Jul 3, 2026
@github-actions

This comment has been minimized.

@SandzSoft SandzSoft changed the title Glasgow | 26-ITP-May | Sandani Kannangara | Data groups/sprint 1 Glasgow | 26-ITP-May | Sandani Kannangara | sprint 1 | Data groups Jul 3, 2026
@SandzSoft SandzSoft added 📅 Sprint 1 Assigned during Sprint 1 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 Jul 3, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good work - your solution is correct. I have one question for you to investigate.

function dedupe(array) {
if (!Array.isArray(array)) return [];

return [...new Set(array)];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a clever approach. Does this preserve the array order?

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.

Yes, it does. Set preserves the insertion order of elements, so converting the array to a Set and then back to an array keeps the first occurrence of each element in its original order while removing duplicates.

Thank you for reviewing, Leon!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good answer!

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. 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 Jul 8, 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. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants