Skip to content

London | 26-ITP-Sep | Mahir Shah | Sprint 1 | Data Groups - #1481

Open
MahirShah300 wants to merge 24 commits into
CodeYourFuture:mainfrom
MahirShah300:Sprint-1
Open

MahirShah300 wants to merge 24 commits into
CodeYourFuture:mainfrom
MahirShah300:Sprint-1

Conversation

@MahirShah300

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

Task code

CYF-1071

Changelist

Implemented tests and functions.

@MahirShah300 MahirShah300 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 30, 2026
@cjyuan cjyuan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 4, 2026
Comment thread Sprint-1/fix/median.js Resolved
Comment thread Sprint-1/implement/dedupe.js Resolved
Comment thread Sprint-1/implement/dedupe.test.js Resolved
Comment thread Sprint-1/implement/describe-median.js Resolved
Comment thread Sprint-1/implement/max.js Outdated
Comment on lines +19 to +21
sortedElements = elements.toSorted((a, b) => a - b);

return sortedElements[sortedElements.length - 1];

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.

This work.

Suggestion: Explore a more efficient approach to find the largest numbers in an array.

@MahirShah300 MahirShah300 Nov 7, 2026 •

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.

Used Math.max(...elements) as a more efficient method

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.

Note: Math.max() works well for numbers.

It is equally important to know how to use a loop to find the extreme value within an array without sorting. Do you know how to implement such a loop? (No change required)

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.

Something such as
let largestNumber = elements[0]

for (const number of elements){
if(number > largestNumber){
largestNumber = number

Comment thread Sprint-1/implement/mean.js Resolved
Comment thread Sprint-1/implement/sum.test.js Resolved
Comment thread Sprint-1/refactor/includes.js Resolved
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Nov 4, 2026
@MahirShah300 MahirShah300 removed the Reviewed Volunteer to add when completing a review with trainee action still to take. label Nov 7, 2026
@MahirShah300 MahirShah300 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 7, 2026

@cjyuan cjyuan left a comment

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.

Changes look good.

Just one more question.

Comment thread Sprint-1/fix/median.js Outdated
(currentValue) =>
typeof currentValue === "number" && !Number.isNaN(currentValue)
(value) =>
typeof value === "number" && !Number.isNaN(value) && Number.isFinite(value)

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.

Could you find out which of these checks are redundant?

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.

typeof value === "number" and !Number.isNaN(value) are the redundant checks, Number.isFinite() returns false for NaN, + and - infinity and non numbers

@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 7, 2026
@MahirShah300 MahirShah300 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 Nov 10, 2026
@cjyuan

cjyuan commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

All 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. labels Nov 10, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants