File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Sprint-3/1-implement-and-rewrite-tests/implement Expand file tree Collapse file tree 1 file changed +5
-3
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 ) return true ;
12- else return false ;
11+ if ( denominator === 0 ) {
12+ throw new Error ( ) ;
13+ }
14+ return Math . abs ( numerator ) < Math . abs ( denominator ) ;
1315}
1416
1517// here's our helper again
@@ -50,7 +52,7 @@ assertEquals(properFraction, true);
5052// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
5153const equalFraction = isProperFraction ( 3 , 3 ) ;
5254// ====> complete with your assertion
53- assertEquals ( equalFraction , false )
55+ assertEquals ( equalFraction , false ) ;
5456
5557// Stretch:
5658// What other scenarios could you test for?
You can’t perform that action at this time.
0 commit comments