Skip to content

Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 1 |fix median, implement sum/max/dedupe, refactor includes - #1409

Open
KhotKeys wants to merge 1 commit into
CodeYourFuture:mainfrom
KhotKeys:sprint-1-solutions
Open

Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 1 |fix median, implement sum/max/dedupe, refactor includes#1409
KhotKeys wants to merge 1 commit into
CodeYourFuture:mainfrom
KhotKeys:sprint-1-solutions

Conversation

@KhotKeys

@KhotKeys KhotKeys commented Aug 8, 2026

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

  • This PR combines all Sprint-1 solutions into one branch: fixed calculateMedian, implemented sum/max/dedupe, refactored includes to use for...of, and solved the AoC 2018 Day 1 stretch challenge.

@KhotKeys KhotKeys changed the title Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 1 |: fix median, implement sum/max/dedupe, refactor includes, so… Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 1 |fix median, implement sum/max/dedupe, refactor includes Aug 8, 2026
@KhotKeys KhotKeys 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. labels Aug 8, 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, I have one comment about median

Comment thread Sprint-1/fix/median.js
if (numbers.length === 0) return null;

// Sort into a new array so the original is never mutated
const sorted = [...numbers].sort((a, b) => a - b);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you use spread here?

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.

Yeah, the .sort() mutates the original array, therefore, I used the spread operator here to make a shallow copy and keep the original array unmutated/pure

@@ -1 +1,5 @@
function dedupe() {}
function dedupe(arr) {
return [...new Set(arr)];

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 use of sets

@LonMcGregor LonMcGregor 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 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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