File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Sprint-3/1-implement-and-rewrite-tests/implement Expand file tree Collapse file tree 1 file changed +3
-8
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 ( Math . abs ( numerator ) < Math . abs ( denominator ) ) return true ; // This version of code works correctly for proper and negative fractions.
12- if ( Math . abs ( numerator ) >= Math . abs ( denominator ) ) return false ;
13- if ( Math . abs ( numerator ) === Math . abs ( denominator ) ) return false ;
14-
15- // if (numerator < denominator) {
16- // return true;
17- // }
11+ return Math . abs ( numerator ) < Math . abs ( denominator ) ;
12+
1813
1914}
2015
@@ -67,5 +62,5 @@ console.log(isProperFraction(5, 2));
6762console . log ( isProperFraction ( - 4 , 7 ) ) ;
6863console . log ( isProperFraction ( - 3 , 3 ) ) ;
6964console . log ( isProperFraction ( - 2 , - 3 ) ) ; // This is a proper fraction because the absolute value of numerator 2 and denominator is 3.
70- // the value of numerator is less than denominator.
65+ // // the value of numerator is less than denominator.
7166console . log ( isProperFraction ( - 4 , - 7 ) ) ;
You can’t perform that action at this time.
0 commit comments