Skip to content

Yana P.#1

Open
YanaP1312 wants to merge 5 commits intoHackYourAssignment:mainfrom
YanaP1312:main
Open

Yana P.#1
YanaP1312 wants to merge 5 commits intoHackYourAssignment:mainfrom
YanaP1312:main

Conversation

@YanaP1312
Copy link
Copy Markdown

  1. Added countAboveThreshold function;
  2. Added unit tests for calculateAverage function;
  3. Fixed bug with VSCode debugger;
  4. Added comparison linear and binary searching.

Copy link
Copy Markdown

@reposman33 reposman33 left a comment

Choose a reason for hiding this comment

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

Few comments, plz review them

Comment thread task-1/count-above-threshold.js Outdated
@@ -1 +1,21 @@
//Your code here
function countAboveThreshold(numbers, threshold) {
let totalAboveNumbers = 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.

let totalNumbersAboveThreshold :)))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point! I renamed the variable to totalNumbersAboveThreshold to make it clearer. Thanks!))


// option 2
// function countAboveThreshold(numbers, threshold) {
// return numbers.filter((number) => number > threshold).length;
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...


// option 3
// function countAboveThreshold(numbers, threshold) {
// return numbers.reduce((sum, number) => sum + (number > threshold), 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.

even nicer!

Comment thread task-3/count-vowels-debug.js Outdated
@@ -1,17 +1,38 @@
function countVowels(text) {
let count = 0;
const textFix = text.toLowerCase();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks! I updated the function so that toLowerCase() is applied only to the current character inside the loop. The new version is pushed.

Comment thread task-4/search-experiment.js Outdated

//linearSearch
console.time("Linear Search 1k");
linearSearch(generateBigArray(1000), 876);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I moved generateBigArray() outside of console.time() so the timer now measures only the search operation, not the array creation.

Comment thread task-4/search-experiment.js Outdated

console.time("Linear Search 100k");
linearSearch(generateBigArray(100000), 98345);
console.timeEnd("Linear Search 100k");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this only outputs a number... it is nice to see something like 'searching for number 98345 in an array of 100000 took xxxx mseconds'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I updated the labels in console.time() so the output now shows a descriptive message like “Searching for Х in array of Y: Zms”. This makes the results clearer and easier to read.

@reposman33 reposman33 added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed Review in progress labels Feb 26, 2026
@github-actions
Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants