Skip to content

Commit 66c03e2

Browse files
sprint 3 task 1 exercise 2 pt1 completed
1 parent 0b0024b commit 66c03e2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
switch (true) {
15+
case Math.abs(numerator / denominator) < 1:
16+
return true;
17+
default:
18+
return false;
19+
}
1520
}
1621

1722
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +36,6 @@ function assertEquals(actualOutput, targetOutput) {
3136

3237
// Example: 1/2 is a proper fraction
3338
assertEquals(isProperFraction(1, 2), true);
39+
assertEquals(isProperFraction(2, 1), false);
40+
assertEquals(isProperFraction(-2, 1), false);
41+
assertEquals(isProperFraction(-2, -4), true);

0 commit comments

Comments
 (0)