Skip to content

LONDON | May-2025 | Anuar Duisenbek | Module-Structuring-and-Testing-Data | Sprint-2 #559

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 6 commits into
base: main
Choose a base branch
from

Conversation

AnuarBey
Copy link

@AnuarBey AnuarBey commented Jun 16, 2025

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

  • Completed all tasks in Sprint-2:
    -Fixed bugs in 1-key-errors and 2-mandatory-debug
    -Implemented functions in 3-mandatory-implement (BMI, unit conversions)
    -Interpreted code and added explanation in 4-mandatory-interpret/time-format.js
    Completed stretch task 5-stretch-extend/format-time.js

Questions

Ask any questions you have for your reviewer.

@AnuarBey AnuarBey added the Needs Review Participant to add when requesting review label Jun 16, 2025
@rohan-corbyn rohan-corbyn self-assigned this Jul 6, 2025
@rohan-corbyn rohan-corbyn 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 6, 2025
Copy link

@rohan-corbyn rohan-corbyn left a comment

Choose a reason for hiding this comment

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

Great work, you've demonstrated your understanding of the topics well and your answers which I didn't comment on were all correct.
I have left a few comments with requests - Please let me know if you have any questions.

@@ -1,13 +1,29 @@
// Predict and explain first...
// =============> write your prediction here
//
// I predict we will make mistake because str has been already declared in body of function

Copy link

@rohan-corbyn rohan-corbyn Jul 6, 2025

Choose a reason for hiding this comment

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

Yes: The variable "str" is declared in the function signature as a parameter, it is then illegally redeclared in the body of the same function.

// Finally, correct the code to fix the problem
// =============> write your new code here
/*

Choose a reason for hiding this comment

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

This is great but I think you left your code commented out.


function makeAllCaps(text) {
return text.toUpperCase().split(" ").join("_");
}

Choose a reason for hiding this comment

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

This works functionally but it could be improved regarding it's time and space complexity.

You are creating a new array when you call split() on a string. Imagine the input String was the size of a chapter in "lord of the rings" and you called split(" ") on the string? The array would be very large and use up memory.

You could instead, use a different single method that replaces characters without using split() and join().

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace

@@ -4,3 +4,22 @@
// You will need to declare a function called toPounds with an appropriately named parameter.

// You should call this function a number of times to check it works for different inputs

Choose a reason for hiding this comment

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

The function only logs the result. It should ideally return the formatted string to make it "reusable" in other areas of your program. For example: when using the function in the rest of the program you might want to pass the result into another function instead of just logging it.

if (hours > 12) {
return `${hours - 12}:00 pm`;
const newHours = String(hours - 12).padStart(2, "0");
return `${newHours}:${minutes} pm`;
}
return `${time} am`;
}

Choose a reason for hiding this comment

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

You didn't write any new tests that provide coverage for the issues you found in the code.
Please also include them. In TDD we write tests first and write the code later. It's a common strategy for ensuring requirements and edge-cases are considered before time is spent solving the problem. Your tests should initially all fail before you start working on the code to make them pass.

@AnuarBey AnuarBey changed the title LONDON | May-2025 | Anuar Duisenbek | Module-Structuring-and-Testing-Data | Sprint-2 LONDON | May-2025 | Anuar Duisenbek | Module-Structuring-and-Testing-Data | Sprint-1 Jul 9, 2025
@AnuarBey AnuarBey changed the title LONDON | May-2025 | Anuar Duisenbek | Module-Structuring-and-Testing-Data | Sprint-1 LONDON | May-2025 | Anuar Duisenbek | Module-Structuring-and-Testing-Data | Sprint-2 Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants