Skip to content

Commit 4be9970

Browse files
authored
Refactor isProperFraction for simplicity
Simplified the isProperFraction function to return the comparison directly.
1 parent 13eba78 commit 4be9970

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

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

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

1313
function isProperFraction(numerator, denominator) {
14-
if (Math.abs(numerator / denominator) < 1) {
15-
return true;// if numerator is smaller than denominator - return true
16-
} else {
17-
return false;//return false if numerator if bigger that denominator
18-
}
14+
return (Math.abs(numerator / denominator) < 1);
1915
}
2016

2117

@@ -44,4 +40,4 @@ assertEquals(isProperFraction(2, 3), true);
4440
assertEquals(isProperFraction(4, 2), false);
4541

4642
// Example: 4/4 is not a proper fraction
47-
assertEquals(isProperFraction(4, 4), false);
43+
assertEquals(isProperFraction(4, 4), false);

0 commit comments

Comments
 (0)