File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Sprint-3/1-implement-and-rewrite-tests/implement Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 88// write one test at a time, and make it pass, build your solution up methodically
99
1010function isProperFraction ( numerator , denominator ) {
11- if ( numerator < denominator ) {
12- return true ;
13- }
14- if ( numerator > denominator ) {
11+ if ( denominator === 0 ) {
1512 return false ;
1613 }
17- if ( numerator === denominator ) {
18- return false ;
14+ if ( Math . abs ( numerator ) < Math . abs ( denominator ) ) {
15+ return true ;
1916 }
17+ return false ;
2018}
2119
2220// The line below allows us to load the isProperFraction function into tests in other files.
@@ -69,7 +67,7 @@ assertEquals(equalFraction, false);
6967// target output: false
7068// Explanation: The fraction -4/-9 is equivalent to 4/9, which is a proper fraction. Function should return false.
7169const bothNegative = isProperFraction ( - 4 , - 9 ) ;
72- assertEquals ( bothNegative , false ) ;
70+ assertEquals ( bothNegative , true ) ;
7371
7472// Zero Numerator check:
7573// Input: numerator = 0, denominator = 7
You can’t perform that action at this time.
0 commit comments