Skip to content

Commit 9faecec

Browse files
committed
2.is-proper-function updated
1 parent 193dfec commit 9faecec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
function isProperFraction(numerator, denominator) {
1111
if (numerator < denominator) {
1212
return true;
13+
} else {
14+
return false;
1315
}
1416
}
1517

@@ -46,14 +48,21 @@ assertEquals(improperFraction, false);
4648
// target output: true
4749
// Explanation: The fraction -4/7 is a proper fraction because the absolute value of the numerator (4) is less than the denominator (7). The function should return true.
4850
const negativeFraction = isProperFraction(-4, 7);
51+
assertEquals(negativeFraction, true);
4952
// ====> complete with your assertion
5053

5154
// Equal Numerator and Denominator check:
5255
// Input: numerator = 3, denominator = 3
5356
// target output: false
5457
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
5558
const equalFraction = isProperFraction(3, 3);
59+
assertEquals(equalFraction, false);
5660
// ====> complete with your assertion
5761

5862
// Stretch:
5963
// What other scenarios could you test for?
64+
const zeroFraction = isProperFraction(0, 5);
65+
assertEquals(zeroFraction, true);
66+
67+
const negativeDenominator = isProperFraction(3, -5);
68+
assertEquals(negativeDenominator, false);

0 commit comments

Comments
 (0)