Skip to content

London | 26-ITP-May | Abdennour Hachemi| Sprint 1| Refactoring - #1582

Open
AbdennourHachemi wants to merge 11 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:sprint-1
Open

AbdennourHachemi wants to merge 11 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:sprint-1

Conversation

@AbdennourHachemi

Copy link
Copy Markdown
  • 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

@github-actions

This comment has been minimized.

@AbdennourHachemi AbdennourHachemi changed the title London | 26-ITP-May | Abdennour Hachemi| Module-Data-Groups| Sprint1 exercises London | 26-ITP-May | Abdennour Hachemi| Module Data-Groups| Sprint1 exercises Nov 24, 2026
@AbdennourHachemi AbdennourHachemi changed the title London | 26-ITP-May | Abdennour Hachemi| Module Data-Groups| Sprint1 exercises London | 26-ITP-May | Abdennour Hachemi| Module Data Groups| Sprint1 exercises Nov 24, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AbdennourHachemi AbdennourHachemi changed the title London | 26-ITP-May | Abdennour Hachemi| Module Data Groups| Sprint1 exercises London | 26-ITP-May | Abdennour Hachemi| Sprint 1| Refactoring Nov 24, 2026
@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 24, 2026
Comment thread Sprint-1/implement/max.js
function findMax(elements) {

let max = -Infinity;
elements.forEach((element) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What happens when the documented non-array input "hey" reaches elements.forEach?

To "like" or "dislike" this comment, please follow this link

Comment thread Sprint-1/implement/mean.js Outdated

if (
!Array.isArray(list) ||
list.some((element) => typeof element !== "number")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some and reduce both skip missing slots, so calculateMean([1, , 3]) passes validation, sums to 4, and divides by 3. The same validation gap appears in Sprint-1/fix/median.js.

To "like" or "dislike" this comment, please follow this link

Comment thread Sprint-1/implement/mean.test.js Outdated
Comment on lines +60 to +61
"culateMean requires an array of numbers"
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What error message would still satisfy this expectation if the leading cal were missing? The same shortened expected message appears in the other two error tests.

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 24, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

@AbdennourHachemi AbdennourHachemi 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 24, 2026

@iscmiguelsamaniego iscmiguelsamaniego 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.

Thank you so much for sharing your work across these katas! Your solutions and tests are super clean and aligned with the acceptance criteria.

Just a gentle question: how might edge cases like NaN, sparse slots, empty arrays, or floats (.toBeCloseTo()) behave here? You're doing awesome!

Comment thread Sprint-1/fix/median.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks so much for sharing! Clean sorting and clear comments—how might Number.isFinite affect tests checking typeof v !== "number", and does the order of the empty-array check matter? Keep going!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks so much for sharing this! Your dedupe logic works nicely for keeping first occurrences in order.

Just a quick, friendly question to explore: how might array.indexOf(number) === index behave on a very large array, and could === help avoid any surprises with ==? You're doing great—keep it up!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing the tests again! I really like how clearly you mapped each test to the acceptance criteria.

Just one gentle question to explore: looking at [1, 2,,2, ...], was that extra comma intentional to test a sparse slot, and how might dedupe behave if undefined is explicitly passed instead? You're doing great!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing this! Using try/catch to translate errors into a readable message is really clean and clear.

Just a gentle question to explore: how might describeMedian behave if an unexpected error without a message is thrown, or if calculateMedian isn't passed as expected in tests? You're doing great!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing these tests! Replacing that old commented test and covering valid numbers, empty arrays, and non-array inputs really aligns with the acceptance criteria.

Just one gentle question to explore: how might describeMedian behave with an even-length array (like [1, 2, 3, 4]), and could adding a test for that help verify the decimal formatting? You're doing awesome!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing these tests! Great job covering empty arrays, negatives, decimals, and non-number elements.

Just a gentle question: which acceptance criterion still needs a test at the bottom, and how might NaN behave if passed in an array? You're doing awesome!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing this! Breaking the validation and calculation into clear numbered steps is super readable.

Just a quick, friendly question: what happens if NaN is in list, and might checking for an empty array before looping save a step? You're doing awesome!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing these tests! Covering single elements, decimals, negatives, empty arrays, and invalid inputs is super thorough.

Just a quick, friendly question: what happens if a test passes NaN inside an array, and how might .toBeCloseTo() help with floating-point decimals? You're doing great!

Comment thread Sprint-1/implement/sum.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing this! Using .some() and .reduce() makes the intent really clear.

Just a quick, friendly question: how might NaN behave with typeof here, and could intialValue have a quick typo to tidy up? You're doing great!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you so much for sharing these tests! Great job covering empty arrays, negatives, decimals, and invalid inputs.

Just a quick, friendly question: what happens with 3.1 + 74.6 + 9.87 + 204.33 + 19.5 in floating-point math, and might we also test 42 or no arguments? You're doing awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants