Skip to content

Commit ca4edc3

Browse files
committed
adjust function to allow for numerator to be 0 and adjust corresponding tests
1 parent 5a195ff commit ca4edc3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
if (denominator === 0 || numerator === 0) return false;
14+
if (denominator === 0) return false;
1515
if (!(denominator % 1 === 0 && numerator % 1 === 0)) return false;
1616
if (Math.abs(numerator) < Math.abs(denominator)) return true;
1717
else return false;
@@ -36,9 +36,10 @@ function assertEquals(actualOutput, targetOutput) {
3636
assertEquals(isProperFraction(1, 2), true);
3737
assertEquals(isProperFraction(-3, 4), true);
3838
assertEquals(isProperFraction(3, -4), true);
39+
assertEquals(isProperFraction(0, 2), true);
40+
41+
//denominator is 0
3942

40-
//numerator or denominator is 0
41-
assertEquals(isProperFraction(0, 2), false);
4243
assertEquals(isProperFraction(2, 0), false);
4344

4445
//result is a whole number

0 commit comments

Comments
 (0)