Skip to content

Conversation

@AhmadHmedann
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have solved all the tasks in the coursework
Thanks in advance for reviewing my code

Questions

none,

@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 26, 2025
Comment on lines 12 to 13
if (numerator < 1) numerator = numerator * -1;
if (denominator < 1) denominator = Math.abs(denominator);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use different approaches to remove the negative sign from a number?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know if you want me to use an existing library or solve it manually.

Copy link
Contributor

Choose a reason for hiding this comment

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

In real interview, developers are expected to explain their code and give a rational explanation why they do things in certain way.

Your code looks odd to me, that's why I raised the question.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for your feedback. From now on, I’ll try to write my code as if I’m working.

Comment on lines 18 to 19
const convertTheStringtoNumber = Number(rank);
if (convertTheStringtoNumber >= 2 && convertTheStringtoNumber <= 10) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In JavaScript, strings that represent valid numeric literals in the language can be safely
converted to equivalent numbers or parsed into a valid integers.
Do you want to recognize these string values as valid ranks?

To find out what these strings are, you can ask AI

What kinds of string values would make Number(rank) evaluate to 2 in JS?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I’ve learned a new validation technique from your feedback.

Comment on lines +14 to +16
test("returns true for a negative proper fraction( absolute value of the numerator is less than the denominator)", () => {
expect(isProperFraction(-4, 7)).toEqual(true);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

When preparing tests, we should ensure the tests cover all possible cases (and maybe test multiple samples within each case to make the test more robust). Can you think of case(s) that should also be tested?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 28, 2025
@AhmadHmedann AhmadHmedann added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 29, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good.

Comment on lines 12 to 13
if (numerator < 1) numerator = Math.abs(numerator) ;
if (denominator < 1) denominator = Math.abs(denominator);
Copy link
Contributor

Choose a reason for hiding this comment

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

denominator < 0 is probably more expressive in the sense that it is closer to the definition of "negative number".

Comment on lines +26 to +28
test("returns false for a negative proper fraction( absolute value of the denominator is less than the numerator)", () => {
expect(isProperFraction(-7, 4)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

  • -7/4 is considered a negative improper fraction.

@cjyuan cjyuan 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 Oct 29, 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