@@ -11,8 +11,18 @@ function getAngleType(angle) {
1111 if ( angle === 90 ) {
1212 return "Right angle" ;
1313 }
14- // Run the tests, work out what Case 2 is testing, and implement the required code here.
15- // Then keep going for the other cases, one at a time.
14+ if ( angle === 45 ) {
15+ return "Acute angle" ;
16+ }
17+ if ( angle === 120 ) {
18+ return "Obtuse angle" ;
19+ }
20+ if ( angle === 180 ) {
21+ return "Straight angle" ;
22+ }
23+ if ( angle > 180 && angle < 360 ) {
24+ return "Reflex angle" ;
25+ }
1626}
1727
1828// The line below allows us to load the getAngleType function into tests in other files.
@@ -50,14 +60,16 @@ assertEquals(acute, "Acute angle");
5060// When the angle is greater than 90 degrees and less than 180 degrees,
5161// Then the function should return "Obtuse angle"
5262const obtuse = getAngleType ( 120 ) ;
53- // ====> write your test here, and then add a line to pass the test in the function above
63+ assertEquals ( obtuse , "Obtuse angle" ) ;
5464
5565// Case 4: Identify Straight Angles:
5666// When the angle is exactly 180 degrees,
5767// Then the function should return "Straight angle"
58- // ====> write your test here, and then add a line to pass the test in the function above
68+ const straight = getAngleType ( 180 ) ;
69+ assertEquals ( straight , "Straight angle" ) ;
5970
6071// Case 5: Identify Reflex Angles:
6172// When the angle is greater than 180 degrees and less than 360 degrees,
6273// Then the function should return "Reflex angle"
63- // ====> write your test here, and then add a line to pass the test in the function above
74+ const reflex = getAngleType ( 240 ) ;
75+ assertEquals ( reflex , "Reflex angle" ) ;
0 commit comments