Skip to content

Commit 36c74ca

Browse files
committed
the proper function is now correct
1 parent b823e9c commit 36c74ca

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88
// write one test at a time, and make it pass, build your solution up methodically
99

1010
function isProperFraction(numerator, denominator) {
11-
if (numerator < denominator) {
12-
return true;
13-
}
14-
if(numerator===denominator){
15-
return false
16-
}
17-
if((Math.abs(numerator))<denominator){
18-
return true
19-
}
20-
if (numerator > denominator) {
11+
if (denominator === 0) {
2112
return false;
2213
}
23-
if (denominator === 0){
24-
return false
14+
if (numerator < denominator && numerator > -denominator) {
15+
return true;
16+
} else {
17+
return false;
2518
}
2619
}
2720

21+
2822
// The line below allows us to load the isProperFraction function into tests in other files.
2923
// This will be useful in the "rewrite tests with jest" step.
3024
module.exports = isProperFraction;

0 commit comments

Comments
 (0)