1212
1313function isProperFraction ( numerator , denominator ) {
1414 // TODO: Implement this function
15+ if ( Math . abs ( numerator ) < Math . abs ( denominator ) ) {
16+ return true ;
17+ } else {
18+ return false ;
1519}
1620
1721// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +35,15 @@ function assertEquals(actualOutput, targetOutput) {
3135
3236// Example: 1/2 is a proper fraction
3337assertEquals ( isProperFraction ( 1 , 2 ) , true ) ;
38+ // Example: 2/1 is not a proper fraction
39+ assertEquals ( isProperFraction ( 2 , 1 ) , false ) ;
40+ // Example: 1/2 is a proper fraction
41+ assertEquals ( isProperFraction ( - 1 , 2 ) , true ) ;
42+ // Example: -1/2 is a proper fraction
43+ assertEquals ( isProperFraction ( - 1 , - 2 ) , true ) ;
44+ // Example: 1/2 is a proper fraction
45+ assertEquals ( isProperFraction ( 1 , - 2 ) , true ) ;
46+ // Example: -2/1 is not a proper fraction
47+ assertEquals ( isProperFraction ( - 2 , 1 ) , false ) ;
48+ // Example: 1/2 is not a proper fraction
49+ assertEquals ( isProperFraction ( - 2 , - 1 ) , false ) ;
0 commit comments