Skip to content

Commit a417fa0

Browse files
committed
Implement isProperFraction to handle proper, improper, and negative fractions
1 parent 5a07227 commit a417fa0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
// Explanation:
2+
// It checks if the absolute value of the numerator
3+
// is less than the absolute value of the denominator.
4+
5+
16
function isProperFraction(numerator, denominator) {
2-
if (numerator < denominator) return true;
3-
// add your completed function from key-implement here
7+
if (denominator === 0) {
8+
throw new Error("Denominator cannot be zero");
9+
}
10+
11+
return Math.abs(numerator) < Math.abs(denominator);
412
}
513

6-
module.exports = isProperFraction;
14+
module.exports = isProperFraction;
15+

0 commit comments

Comments
 (0)