1111// execute the code to ensure all tests pass.
1212
1313function isProperFraction ( numerator , denominator ) {
14- // TODO: Implement this function
14+ return Math . abs ( numerator ) < Math . abs ( denominator ) ;
1515}
1616
1717// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +31,20 @@ function assertEquals(actualOutput, targetOutput) {
3131
3232// Example: 1/2 is a proper fraction
3333assertEquals ( isProperFraction ( 1 , 2 ) , true ) ;
34+
35+ assertEquals ( isProperFraction ( 3 , 4 ) , true ) ;
36+ assertEquals ( isProperFraction ( - 1 , 2 ) , true ) ;
37+
38+ // Equal numerator and denominator
39+ assertEquals ( isProperFraction ( 2 , 2 ) , false ) ;
40+
41+ // Improper fractions
42+ assertEquals ( isProperFraction ( 3 , 2 ) , false ) ;
43+ assertEquals ( isProperFraction ( 5 , 3 ) , false ) ;
44+ assertEquals ( isProperFraction ( - 3 , 2 ) , false ) ;
45+
46+ // Zero numerator
47+ assertEquals ( isProperFraction ( 0 , 2 ) , true ) ;
48+
49+ // Negative denominator
50+ assertEquals ( isProperFraction ( 1 , - 2 ) , true ) ;
0 commit comments