Skip to content

LONDON | MAY2025 | EMILIANO URUENA | DATA_GROUPS | Sprint-1 #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Emilianouz
Copy link

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Sprint 1 - Module DATA GROUPS
COMMITS:

  1. Fixed median.js and median.test.js / Sprint-1 MODULE-DATA-GROUPS
  2. Implemented: dedupe.js, dedupe.test.js, max.js, max.test.js, sum.js, sum.test.js / Sprint-1 MODULE-DATA-GROUPS
  3. Refactor includes.js using for…of / Sprint-1 MODULE-DATA-GROUPS

@Emilianouz Emilianouz added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Participant to add when requesting review labels Jul 2, 2025
@AdnanGondal AdnanGondal self-assigned this Jul 14, 2025
@AdnanGondal AdnanGondal added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Jul 14, 2025
return null
}
// the next code from 13 to 16create a new Array called listFiltered checking if the elements are numbers and no NaN>
const listFiltered = list.filter(checkElement);

Choose a reason for hiding this comment

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

Using an anonymous function here will make this method more concise (instead of checkElement).

return median
} else {
const median = listFiltered.splice(middleIndex, 1)[0];
return median

Choose a reason for hiding this comment

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

Using an Inline return statement on this line and line 28 is best practice

}
if (elements.length === 0) return '-Infinity';
if (elements.length === 1) return elements;
let maxNum = []

Choose a reason for hiding this comment

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

Why is maxNum an array? A number type as the return value is most appropriate for this function.


);
[
{ input: ['e','r','n','a','l','g','l'], expected: 'Family'},

Choose a reason for hiding this comment

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

Is 'Family' the best value to return in this case? Why not return something like null.

noNum.push(elements[i])
}
}
if (elements.length === noNum.length) return 'Family'

Choose a reason for hiding this comment

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

Again, is returning 'Family' the most appropriate here? Why not either 0 or null?

if (typeof elements[i] === 'number'){
sum += elements[i];
} else {
noNum.push(elements[i])

Choose a reason for hiding this comment

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

Is there a better way to check if the array contains no numbers, instead of making a new array and adding all the elements to it? Every array in your code will use more memory, and for very large inputs this will be inefficient.

@AdnanGondal
Copy link

A good start - but there is still some work to do. Please address the comments and I will review it again.

@AdnanGondal AdnanGondal added Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 14, 2025
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 📅 Sprint 1 Assigned during Sprint 1 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants