Skip to content

Commit ba7c348

Browse files
committed
update: Implement angle type identification in getAngleType function
1 parent 4c2c13b commit ba7c348

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Sprint-3/1-key-implement/1-get-angle-type.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
// Then, write the next test! :) Go through this process until all the cases are implemented
99

1010
function getAngleType(angle) {
11-
if (angle === 90) return "Right angle";
12-
// read to the end, complete line 36, then pass your test here
11+
if (angle === 90) return "Right angle";
12+
// read to the end, complete line 36, then pass your test here
13+
// if the angle is less than 90, return "Acute angle"
14+
if (angle < 90) return "Acute angle";
15+
// if the angle is greater than 90 and less than 180, return "Obtuse angle"
16+
if (angle > 90 && angle < 180) return "Obtuse angle";
17+
// if the angle is exactly 180, return "Straight angle"
18+
if (angle === 180) return "Straight angle";
19+
// if the angle is greater than 180 and less than 360, return "Reflex angle"
20+
if (angle > 180 && angle < 360) return "Reflex angle";
1321
}
1422

1523
// we're going to use this helper function to make our assertions easier to read
@@ -43,14 +51,19 @@ assertEquals(acute, "Acute angle");
4351
// When the angle is greater than 90 degrees and less than 180 degrees,
4452
// Then the function should return "Obtuse angle"
4553
const obtuse = getAngleType(120);
54+
assertEquals(obtuse, "Obtuse angle");
4655
// ====> write your test here, and then add a line to pass the test in the function above
4756

4857
// Case 4: Identify Straight Angles:
4958
// When the angle is exactly 180 degrees,
5059
// Then the function should return "Straight angle"
5160
// ====> write your test here, and then add a line to pass the test in the function above
61+
const straightAngle = getAngleType(180);
62+
assertEquals(straightAngle, "Straight angle");
5263

5364
// Case 5: Identify Reflex Angles:
5465
// When the angle is greater than 180 degrees and less than 360 degrees,
5566
// Then the function should return "Reflex angle"
56-
// ====> write your test here, and then add a line to pass the test in the function above
67+
// ====> write your test here, and then add a line to pass the test in the function above
68+
const reflex = getAngleType(270);
69+
assertEquals(reflex, "Reflex angle");

0 commit comments

Comments
 (0)