-
-
Notifications
You must be signed in to change notification settings - Fork 279
Glasgow| 2026-ITP-Jan | Tuan Nguyen| Sprint 1 | Array-and-Loop. #1189
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
Jacknguyen4438
wants to merge
16
commits into
CodeYourFuture:main
Choose a base branch
from
Jacknguyen4438:Array-and-Loop-sprint-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+129
−8
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ff7f2fc
Making some fix for the jest test
Jacknguyen4438 7fb1d60
fix the jest to correction and finish first part
Jacknguyen4438 558b61f
Make some basic change for the task
Jacknguyen4438 d17be19
make a list of to do jest test for max.js
Jacknguyen4438 a647b10
making some jest test for course work
Jacknguyen4438 530533c
Make some final jest test for submission
Jacknguyen4438 adf5466
make some change for max.js jest test
Jacknguyen4438 bbd2d7e
making change and jest test for sum
Jacknguyen4438 591925a
Format sum.js,max.js,dedupe.js and add test to dedupe.test.js
Jacknguyen4438 bf6c830
Remove all todo each jest test
Jacknguyen4438 1f124e8
Basic change
Jacknguyen4438 1665dd5
making some change for PR
Jacknguyen4438 8a782f1
making change for resubmission
Jacknguyen4438 228792c
changing to original
Jacknguyen4438 6c8e598
revert the test back to normal and fixing the filter test
Jacknguyen4438 6d494ec
make final change for reviewing
Jacknguyen4438 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,12 @@ | ||
| function dedupe() {} | ||
| function dedupe(inputArray) { | ||
| if (inputArray.length === 0) return inputArray; | ||
| let fixArray = []; | ||
| for (const item of inputArray) { | ||
| if (!fixArray.includes(item)) { | ||
| fixArray.push(item); | ||
| } | ||
| } | ||
| return fixArray; | ||
| } | ||
|
|
||
| module.exports = dedupe; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| function findMax(elements) { | ||
| if (elements.length === 0) return -Infinity; | ||
|
|
||
| const filteredArray = elements.filter( | ||
| (item) => typeof item === "number" && !isNaN(item) | ||
| ); | ||
| if (filteredArray.length === 0) return null; | ||
| const sortedArray = filteredArray.sort((a, b) => a - b); | ||
| const maxArrayValue = sortedArray[sortedArray.length - 1]; | ||
| return maxArrayValue; | ||
| } | ||
|
|
||
| module.exports = findMax; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,14 @@ | ||
| function sum(elements) { | ||
| if (elements.length === 0) return 0; | ||
| let filteredArray = elements.filter( | ||
| (items) => typeof items === "number" && !isNaN(items) | ||
| ); | ||
| if (filteredArray.length === 0) return null; | ||
| let sumTotal = 0; | ||
| for (let i = 0; i < filteredArray.length; i++) { | ||
| sumTotal += filteredArray[i]; | ||
| } | ||
| return sumTotal; | ||
| } | ||
|
|
||
| module.exports = sum; |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.