Skip to content

Commit eee7b7f

Browse files
Math.abs to check proper fraction
1 parent 9d74d04 commit eee7b7f

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

‎implement-and-rewrite-tests/implement/2-is-proper-fraction.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ export function isProperFraction(numerator, denominator) {
1818
return false;
1919
}
2020

21-
if (numerator < 0) {
22-
numerator = -numerator;
23-
}
24-
25-
if (denominator < 0) {
26-
denominator = -denominator;
27-
}
28-
29-
if (numerator < denominator) {
30-
return true;
31-
} else {
32-
return false;
33-
}
21+
return Math.abs(numerator) < Math.abs(denominator);
3422
}
23+
console.log(isProperFraction(1, 3));

0 commit comments

Comments
 (0)