Skip to content

Commit 5e720c8

Browse files
fix: update isProperFraction to return false for zero denominator instead of throwing an error
1 parent 7dc44ec commit 5e720c8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
// write one test at a time, and make it pass, build your solution up methodically
99

1010
function isProperFraction(numerator, denominator) {
11-
if (denominator === 0) {
12-
throw new Error();
13-
}
11+
if (denominator === 0) return false; // avoid division by zero
1412
return Math.abs(numerator) < Math.abs(denominator);
1513
}
1614

0 commit comments

Comments
 (0)