We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb1d90f commit 2f42a85Copy full SHA for 2f42a85
Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js
@@ -8,11 +8,9 @@
8
// write one test at a time, and make it pass, build your solution up methodically
9
10
function isProperFraction(numerator, denominator) {
11
- // First check: both numerator and denominator should be positive
12
- if (numerator < 0 || denominator < 0) {
13
- return false;
14
- }
15
-
+ // First check: convert negative numbers to positive before comparing
+ numerator = Math.abs(numerator);
+ denominator = Math.abs(denominator);
16
// Second check: numerator should be less than denominator
17
if (numerator < denominator) {
18
return true;
0 commit comments