88// Then, write the next test! :) Go through this process until all the cases are implemented
99
1010function getAngleType ( angle ) {
11+ angleType = "" ;
1112 if ( angle === 90 ) {
12- return "Right angle" ;
13+ angleType = "Right angle" ;
14+ } else if ( angle < 90 ) {
15+ angleType = "Acute angle" ;
16+ } else if ( angle > 90 && angle < 180 ) {
17+ angleType = "Obtuse angle" ;
18+ } else if ( angle === 180 ) {
19+ angleType = "Straight angle" ;
20+ } else if ( angle > 180 && angle < 360 ) {
21+ angleType = "Reflex angle" ;
1322 }
23+ return angleType ;
1424 // Run the tests, work out what Case 2 is testing, and implement the required code here.
1525 // Then keep going for the other cases, one at a time.
1626}
@@ -37,6 +47,7 @@ function assertEquals(actualOutput, targetOutput) {
3747// Case 1: Identify Right Angles:
3848// When the angle is exactly 90 degrees,
3949// Then the function should return "Right angle"
50+
4051const right = getAngleType ( 90 ) ;
4152assertEquals ( right , "Right angle" ) ;
4253
@@ -51,13 +62,18 @@ assertEquals(acute, "Acute angle");
5162// Then the function should return "Obtuse angle"
5263const obtuse = getAngleType ( 120 ) ;
5364// ====> write your test here, and then add a line to pass the test in the function above
65+ assertEquals ( obtuse , "Obtuse angle" ) ;
5466
5567// Case 4: Identify Straight Angles:
5668// When the angle is exactly 180 degrees,
5769// Then the function should return "Straight angle"
5870// ====> write your test here, and then add a line to pass the test in the function above
71+ const straight = getAngleType ( 180 ) ;
72+ assertEquals ( straight , "Straight angle" ) ;
5973
6074// Case 5: Identify Reflex Angles:
6175// When the angle is greater than 180 degrees and less than 360 degrees,
6276// 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
77+ // ====> write your test here, and then add a line to pass the test in the function above
78+ const reflex = getAngleType ( 270 ) ;
79+ assertEquals ( reflex , "Reflex angle" ) ;
0 commit comments