Skip to content

Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups #1016

Open
libanj0161 wants to merge 5 commits intoCodeYourFuture:mainfrom
libanj0161:Module-Data-Groups-fix
Open

Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups #1016
libanj0161 wants to merge 5 commits intoCodeYourFuture:mainfrom
libanj0161:Module-Data-Groups-fix

Conversation

@libanj0161
Copy link

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

Completed Fix under data groups module.

Questions

N/A.

@libanj0161 libanj0161 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 Mar 16, 2026
@libanj0161 libanj0161 added the Module-Data-Groups The name of the module. label Mar 16, 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 Mar 16, 2026
@libanj0161 libanj0161 changed the title Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Module-data-Groups Fix Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Fix Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 changed the title Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Fix Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 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 Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed 📅 Sprint 1 Assigned during Sprint 1 of this module labels Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 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 Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@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 Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 16, 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 Mar 16, 2026
@libanj0161 libanj0161 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed 📅 Sprint 1 Assigned during Sprint 1 of this module labels Mar 16, 2026
Comment on lines +15 to +23
let numbers = [];

// loop over each item in list.
for (const item of list) {
// if item is a number, push it into the numbers array.
if (typeof item === "number") {
numbers.push(item);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Could consider using array's .filter() method to simplify the code on lines 15-23.

  • Do you plan to consider -Infinity, Infinity, and NaN in the median calculation (and also in the functions in implement/max.js and implement/sum.js)?

Comment on lines 23 to 29
// Given an array with no duplicates
// When passed to the dedupe function
// Then it should return a copy of the original array

// Given an array with strings or numbers
// When passed to the dedupe function
// Then it should remove the duplicate values, preserving the first occurence of each element
Copy link
Contributor

Choose a reason for hiding this comment

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

There are two more tests to be implemented on this file.

Comment on lines +59 to +69
test("given an array with non-number values, returns the max and ignore non-numeric values", () => {
expect(findMax([3, "dogs", 1, "cat", null])).toBe(3);
});

// Given an array with only non-number values
// When passed to the max function
// Then it should return the least surprising value given how it behaves for all other inputs

test("given an array with only non-number values, returns -Infinity", () => {
expect(findMax(["a", null, true, undefined])).toBe(-Infinity);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

When a string representing a valid numeric literal (for example, "300") is compared to a number,
JavaScript first converts the string into its numeric equivalent before performing the comparison.
As a result, the expression 20 < "300" evaluates to true.

To test if the function can correctly ignore non-numeric values,
consider including a string such as "300" in the relevant test cases.

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

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants