Skip to content

Manchester | 26-ITP-May | Abdu Hassen | Sprint 1 | Data Groups - #1257

Open
Abduhasen wants to merge 3 commits into
CodeYourFuture:mainfrom
Abduhasen:Data-Group-sprint-1-backlog
Open

Manchester | 26-ITP-May | Abdu Hassen | Sprint 1 | Data Groups#1257
Abduhasen wants to merge 3 commits into
CodeYourFuture:mainfrom
Abduhasen:Data-Group-sprint-1-backlog

Conversation

@Abduhasen

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

-writing test cases for a function

  • refactoring codes

Questions

N/A

@Abduhasen Abduhasen 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 18, 2026
@hey-hammad hey-hammad 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 Jul 27, 2026

@hey-hammad hey-hammad 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.

Nice effort overall, please review the comments and fix the code quality issues, Also several tests are duplicated and share identical descriptions, and some test names could be made clearer. Consider adding edge cases for NaN and arrays containing a single non-numeric value.

Comment thread Sprint-1/fix/median.js Outdated
if (!Array.isArray(list)) {
return null;
}
list = list.filter((item) => typeof item === "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.

It would be better to create a new variable so the filter operation doesn't modify the input(original array)

also please review the following for a more robust validation.

https://www.w3schools.com/js/js_nan.asp

Comment thread Sprint-1/fix/median.js Outdated
return null;
}
list = list.filter((item) => typeof item === "number");
if (list.length === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Its best to put all the guard clauses at start of the function.

https://medium.com/@timothydan/javascript-guard-clauses-64b999e3240

Comment thread Sprint-1/fix/median.js Outdated
Comment thread Sprint-1/implement/dedupe.js Outdated
Comment thread Sprint-1/implement/max.js Outdated
} else if (elements.length === 1) {
return elements[0];
}
const number = elements.filter((value) => typeof value === "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.

please review the following for a more robust validation.

https://www.w3schools.com/js/js_nan.asp

Comment thread Sprint-1/implement/max.js Outdated
function findMax(elements) {
if (elements.length === 0) {
return Infinity;
} else if (elements.length === 1) {

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 will happen if there is only a single item in the array and that item is a string?

Comment thread Sprint-1/implement/max.js
@@ -1,4 +1,20 @@
function findMax(elements) {
if (elements.length === 0) {
return Infinity;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread Sprint-1/implement/max.js Outdated
@hey-hammad hey-hammad 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 Jul 27, 2026
@Abduhasen Abduhasen 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 Aug 5, 2026
@hey-hammad hey-hammad 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 Aug 7, 2026
Comment thread Sprint-1/fix/median.js Outdated
if (!Array.isArray(list)) {
return null;
}
filteredList = list.filter((item) => typeof item === "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.

  • What happens if a variable is assigned without a declaration in JavaScript?

  • What would happen if you pass the following input to the function?
    [1, 2, 3,NaN, 4, 5]

Comment thread Sprint-1/implement/sum.js Outdated
if (elements.length === 0) {
return 0;
}
const number = elements.filter((value) => typeof value === "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.

What would happen if you pass the following input to the function?
[1, 2, 3,NaN, 4, 5]

@hey-hammad hey-hammad 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 Aug 7, 2026
@Abduhasen Abduhasen 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 Aug 10, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. 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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 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. Module-Data-Groups The name of the module. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants