1515// execute the code to ensure all tests pass.
1616
1717function getAngleType ( angle ) {
18- // TODO: Implement this function
18+ function getAngleType ( angle ) {
19+ if ( angle <= 0 || angle >= 360 )
20+ }
21+
22+ if ( angle < 90 ) {
23+ return "actue angle" ;
24+ }
25+ if ( angle === 90 ) {
26+ return "right angle" ;
27+ }
28+ if ( angle < 180 ) {
29+ return "obtuse angle" ;
30+ }
31+ if ( angle === 180 ) {
32+ return "straight angle" ;
33+ }
34+ if ( angle < 360 ) {
35+ return "reflext angle" ;
1936}
37+ module . exports = getAngleType ;
38+
39+
40+ // TODO: Implement this function
41+
2042
2143// The line below allows us to load the getAngleType function into tests in other files.
2244// This will be useful in the "rewrite tests with jest" step.
23- module . exports = getAngleType ;
45+
2446
2547// This helper function is written to make our assertions easier to read.
2648// If the actual output matches the target output, the test will pass
@@ -35,3 +57,11 @@ function assertEquals(actualOutput, targetOutput) {
3557// Example: Identify Right Angles
3658const right = getAngleType ( 90 ) ;
3759assertEquals ( right , "Right angle" ) ;
60+
61+ // Test
62+ assertEquals ( getAngleType ( 45 ) , "Acute angle" ) ;
63+ assertEquals ( getAngleType ( 90 ) , "Right angle" ) ;
64+ assertEquals ( getAngleType ( 120 ) , "Obtuse angle" ) ;
65+ assertEquals ( getAngleType ( 180 ) , "Straight angle" ) ;
66+ assertEquals ( getAngleType ( 270 ) , "Reflex angle" ) ;
67+ assertEquals ( getAngleType ( 390 ) , "invalid angle" ) ;
0 commit comments