Skip to content

Commit 5061ffe

Browse files
committed
feat: add conditional structure to check angles in the function
1 parent 124ae45 commit 5061ffe

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@
1515
// execute the code to ensure all tests pass.
1616

1717
function getAngleType(angle) {
18-
// TODO: Implement this function
18+
if(angle < 90){
19+
return "Acute angle";
20+
} else if (angle === 90){
21+
return "Right angle";
22+
} else if (angle > 90 && angle < 180){
23+
return "Obtuse angle";
24+
} else if (angle === 180){
25+
return "Straight angle";
26+
} else if (angle > 180 && angle < 360){
27+
return "Reflex angle";
28+
}
29+
return "invalid angle";
30+
1931
}
2032

2133
// The line below allows us to load the getAngleType function into tests in other files.
@@ -35,3 +47,4 @@ function assertEquals(actualOutput, targetOutput) {
3547
// Example: Identify Right Angles
3648
const right = getAngleType(90);
3749
assertEquals(right, "Right angle");
50+

0 commit comments

Comments
 (0)