Skip to content

Conversation

nahommesfin77
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

In Implement, I wrote functions step-by-step with assertions to cover different cases. In Rewrite, I converted previous assertions to use Jest syntax for clearer and easier testing. In Practice I built and ran tests using Jest and vscode's code runner to ensure all functions meet requirements.

@nahommesfin77 nahommesfin77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 21, 2025
@LonMcGregor LonMcGregor added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 22, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Good start, but you may want to take more time to work on this sprint - there are a few tasks that have problems.

@@ -9,6 +9,7 @@

function isProperFraction(numerator, denominator) {
if (numerator < denominator) return true;

Choose a reason for hiding this comment

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

What happens if I call isProperFraction(-70,5)?

-70/5 is not a proper fraction.

Copy link
Author

@nahommesfin77 nahommesfin77 Aug 8, 2025

Choose a reason for hiding this comment

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

The assertion will fail because i have not used aboslute value Maths.abs in my function to determine if a negative fractioon is really a proper fraction or not. I have fixed and changed the condition to return absolute values.
line 11

  • I have change the if conditon to return Math.abs(numerator) < Math.abs(denominator);

if (rank === "A") return 11;
if (rank >= '2' && rank <= '9') return Number(rank);

Choose a reason for hiding this comment

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

What happens if I call getCardValue("222♥")?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it should have thrown an error, but because of string comparison of "222" and "2" it will pass the condition and logs 222. I have fixed this issue by using regular expression.

  • Updated line 13
    if (/^[2-9]$/.test(rank)) return Number(rank);

@@ -1,5 +1,11 @@
function countChar(stringOfCharacters, findCharacter) {
return 5
let count = 0;

Choose a reason for hiding this comment

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

This is very minor - try to keep the indentation the same for all the code. here your first declaration is indented further.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will. thanks for noticing, I have adjusted the identation.

@@ -1,5 +1,8 @@
function getOrdinalNumber(num) {

Choose a reason for hiding this comment

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

In english we would say "21st" - can you make your code work in these general cases too?

Copy link
Author

Choose a reason for hiding this comment

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

I have updated the function to include cases like 21st, 22nd and so on. I have used a modulo operator to get the last digits of the numbers num % 10; and num % 100; and used them to determine the cases for each number.

  • Updated line 2 to 10

function repeat() {
return "hellohellohello";
function repeat(str, count) {
return str.repeat(count);

Choose a reason for hiding this comment

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

What about your error condition you are testing for?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, i should have added an error conditon to throw an error. I have added an error that throws a negative integer.

  • line 2 - 4
    if (count < 0) { throw new Error("Count must be a non-negative integer."); }

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 22, 2025
@nahommesfin77 nahommesfin77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 8, 2025
@LonMcGregor
Copy link

Great work making these changes - you are done with this sprint now

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 9, 2025
@nahommesfin77 nahommesfin77 removed the Reviewed Volunteer to add when completing a review with trainee action still to take. label Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and all review comments have been addressed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants