Skip to content

Commit 2007dc3

Browse files
committed
made correct adjustment for properfrac
1 parent 1e399a1 commit 2007dc3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ function isProperFraction(numerator, denominator) {
1414
if (denominator === 0) {
1515
return false;
1616
}
17-
else if (numerator >= 0 && denominator !== 0) {
1817

1918
return Math.abs(numerator) < Math.abs(denominator);
2019
}
21-
}
20+
2221

2322
function assertEquals(actualOutput, targetOutput) {
2423
console.assert(
@@ -55,6 +54,14 @@ const case7 = isProperFraction(5, 0);
5554
assertEquals(case7, false);
5655
console.log(isProperFraction(5, 0));
5756

57+
const case8 = isProperFraction(-1, 2);
58+
assertEquals(case8, true);
59+
console.log(isProperFraction(-1, 2));
60+
61+
const case9 = isProperFraction(1, -2);
62+
assertEquals(case9, true);
63+
console.log(isProperFraction(1, -2));
64+
5865
module.exports = isProperFraction;
5966

6067
// The line below allows us to load the isProperFraction function into tests in other files.

0 commit comments

Comments
 (0)