London | 26-ITP-May | Zadri Abdule | Sprint 1 | Data groups#1238
Open
Zadri415 wants to merge 6 commits into
Open
London | 26-ITP-May | Zadri Abdule | Sprint 1 | Data groups#1238Zadri415 wants to merge 6 commits into
Zadri415 wants to merge 6 commits into
Conversation
LonMcGregor
reviewed
Jul 13, 2026
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work on these tasks. I have some follow up questions
| // Keep only actual numbers. This filters out strings, null, undefined, objects, etc. | ||
| // We deliberately do not coerce numeric strings (e.g. "3") to numbers — tests expect | ||
| // non-number values to be ignored rather than parsed. | ||
| const numericList = list.filter((item) => typeof item === "number" && Number.isFinite(item)); |
There was a problem hiding this comment.
What are you checking for here with isFinite?
Author
There was a problem hiding this comment.
To check whether a value is a regular number.
|
|
||
| // iterate in order; if unseen -> keep it | ||
| for (const item of arr) { | ||
| if (!seen.has(item)) { |
There was a problem hiding this comment.
Do you need to check if the set has an item before adding it?
| function sum(elements) { | ||
| let total = 0; | ||
| for (let i = 0; i < elements.length; i++) { | ||
| if (typeof elements[i] === "number") { |
There was a problem hiding this comment.
Do you know if there are any valid "number" types that you wouldn't be able to add together?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
fix: corrected calculateMedian in median.js and added tests
feat: implemented dedupe with tests (dedupe.js, dedupe.test.js)
feat: implemented findMax and tests (max.js, max.test.js)
test: added tests for sum (sum.test.js)
refactor: switched includes loop to for...of (includes.js)
feat: added AoC 2018 Day 1 solution (solution.js)
Questions
N/A