1111// execute the code to ensure all tests pass.
1212
1313function isProperFraction ( numerator , denominator ) {
14- // TODO: Implement this function
15- // if (numerator < denominator) {
16- // return true
17- // }
18- return numerator < denominator ;
14+ // should change negative numbers to absolute numbers
15+ return Math . abs ( numerator ) < Math . abs ( denominator ) ;
1916}
2017
2118// The line below allows us to load the isProperFraction function into tests in other files.
@@ -40,7 +37,13 @@ assertEquals(isProperFraction(1, 2), true);
4037// Tests
4138assertEquals ( isProperFraction ( 2 , 3 ) , true ) ;
4239assertEquals ( isProperFraction ( 3 , 1 ) , false ) ;
43- assertEquals ( isProperFraction ( - 1 , - 6 ) , false ) ;
44- assertEquals ( isProperFraction ( - 1 , 0 ) , true ) ;
40+ assertEquals ( isProperFraction ( - 1 , - 6 ) , true ) ;
41+ assertEquals ( isProperFraction ( - 1 , 0 ) , false ) ;
4542assertEquals ( isProperFraction ( 1 , 1 ) , false ) ;
46- assertEquals ( isProperFraction ( - 6 , 6 ) , true ) ;
43+ assertEquals ( isProperFraction ( - 6 , 6 ) , false ) ;
44+
45+ assertEquals ( isProperFraction ( - 1 , - 2 ) , true ) ;
46+ assertEquals ( isProperFraction ( 1 , - 2 ) , true ) ;
47+ assertEquals ( isProperFraction ( - 1 , 2 ) , true ) ;
48+ assertEquals ( isProperFraction ( 1 , 0 ) , false ) ;
49+ assertEquals ( isProperFraction ( - 1 , 0 ) , false ) ;
0 commit comments