1515// execute the code to ensure all tests pass.
1616
1717function getAngleType ( angle ) {
18- // TODO: Implement this function
18+ if ( angle > 0 && angle < 90 ) return "Acute angle" ;
19+ if ( angle === 90 ) return "Right angle" ;
20+ if ( angle > 90 && angle < 180 ) return "Obtuse angle" ;
21+ if ( angle === 180 ) return "Straight angle" ;
22+ if ( angle > 180 && angle < 360 ) return "Reflex angle" ;
23+ else return "Invalid angle" ;
1924}
2025
2126// The line below allows us to load the getAngleType function into tests in other files.
@@ -35,3 +40,18 @@ function assertEquals(actualOutput, targetOutput) {
3540// Example: Identify Right Angles
3641const right = getAngleType ( 90 ) ;
3742assertEquals ( right , "Right angle" ) ;
43+
44+ const straight = getAngleType ( 180 ) ;
45+ assertEquals ( straight , "Straight angle" ) ;
46+
47+ const acute = getAngleType ( 47 ) ;
48+ assertEquals ( acute , "Acute angle" ) ;
49+
50+ const obtuse = getAngleType ( 139 ) ;
51+ assertEquals ( obtuse , "Obtuse angle" ) ;
52+
53+ const reflex = getAngleType ( 258 ) ;
54+ assertEquals ( reflex , "Reflex angle" ) ;
55+
56+ const invalid = getAngleType ( 360 ) ;
57+ assertEquals ( invalid , "Invalid angle" ) ;
0 commit comments