Open
Conversation
YanaP1312
commented
Feb 9, 2026
- Added countAboveThreshold function;
- Added unit tests for calculateAverage function;
- Fixed bug with VSCode debugger;
- Added comparison linear and binary searching.
reposman33
reviewed
Feb 26, 2026
| @@ -1 +1,21 @@ | |||
| //Your code here | |||
| function countAboveThreshold(numbers, threshold) { | |||
| let totalAboveNumbers = 0; | |||
There was a problem hiding this comment.
let totalNumbersAboveThreshold :)))
|
|
||
| // option 2 | ||
| // function countAboveThreshold(numbers, threshold) { | ||
| // return numbers.filter((number) => number > threshold).length; |
|
|
||
| // option 3 | ||
| // function countAboveThreshold(numbers, threshold) { | ||
| // return numbers.reduce((sum, number) => sum + (number > threshold), 0); |
| @@ -1,17 +1,38 @@ | |||
| function countVowels(text) { | |||
| let count = 0; | |||
| const textFix = text.toLowerCase(); | |||
There was a problem hiding this comment.
I would do this toLowerCase() on each character within the loop because it is more precise - you only do toLowerCase() on the character you want to test, not on the whole text
|
|
||
| //linearSearch | ||
| console.time("Linear Search 1k"); | ||
| linearSearch(generateBigArray(1000), 876); |
There was a problem hiding this comment.
generateBigArray(1000) should not be part of the console.time)... because now you measure 2 things: the time to generate a big array plus the time to search through the big array
|
|
||
| console.time("Linear Search 100k"); | ||
| linearSearch(generateBigArray(100000), 98345); | ||
| console.timeEnd("Linear Search 100k"); |
There was a problem hiding this comment.
this only outputs a number... it is nice to see something like 'searching for number 98345 in an array of 100000 took xxxx mseconds'
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.