We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fad2100 commit 1154f89Copy full SHA for 1154f89
Sprint-3/2-mandatory-rewrite/2-is-proper-fraction.js
@@ -1,7 +1,12 @@
1
function isProperFraction(numerator, denominator) {
2
- if (Math.abs(numerator) < Math.abs(denominator)) return true; // This version of code works correctly for proper and negative fractions.
3
- if (Math.abs(numerator) >= Math.abs(denominator)) return false;
4
- if (Math.abs(numerator) === Math.abs(denominator)) return false;
+ if (denominator === 0) {
+ return false;
+ } else if (Math.abs(numerator) < Math.abs(denominator)) {
5
+ return true;
6
+ } else {
7
8
+ }
9
}
10
11
+// This version of code works correctly for proper and negative fractions.
12
module.exports = isProperFraction;
0 commit comments