Skip to content

Commit 8cb7495

Browse files
committed
update: include code for denominator must not be zero
1 parent 9c478cd commit 8cb7495

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Sprint-3/1-key-implement/2-is-proper-fraction.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
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-
// Denominator can't be zero in a valid fraction
13-
return false;
14-
}
15-
// if (numerator < denominator) return true; it will not work for negative numbers
11+
if (numerator < denominator) return true; //it will is proper fraction
12+
if (denominator === 0) return false; // Denominator cannot be zero
13+
1614
return Math.abs(numerator) < Math.abs(denominator);
1715
}
1816

0 commit comments

Comments
 (0)