Skip to content

Commit fcd1c54

Browse files
refactor angle type checks for improved readability and consistency
1 parent 801f259 commit fcd1c54

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

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

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

1010
function getAngleType(angle) {
11-
if(angle===180){
11+
if(angle === 180){
1212
return "Straight angle"
1313
}
14-
if(angle>90 && angle<180){
14+
if(angle > 90 && angle < 180){
1515
return "Obtuse angle"
1616
}
1717
if (angle === 90) {
@@ -20,7 +20,7 @@ function getAngleType(angle) {
2020
if (angle < 90) {
2121
return "Acute angle";
2222
}
23-
if(angle>180 && angle<360){
23+
if(angle > 180 && angle < 360){
2424
return "Reflex angle"
2525
}
2626
// Run the tests, work out what Case 2 is testing, and implement the required code here.
@@ -69,12 +69,12 @@ assertEquals(obtuse, "Obtuse angle");
6969
// When the angle is exactly 180 degrees,
7070
// Then the function should return "Straight angle"
7171
// ====> write your test here, and then add a line to pass the test in the function above
72-
const straight=getAngleType(180);
72+
const straight = getAngleType(180);
7373
assertEquals(straight,"Straight angle")
7474

7575
// Case 5: Identify Reflex Angles:
7676
// When the angle is greater than 180 degrees and less than 360 degrees,
7777
// Then the function should return "Reflex angle"
7878
// ====> write your test here, and then add a line to pass the test in the function above
79-
const reflex=getAngleType(200);
79+
const reflex = getAngleType(200);
8080
assertEquals(reflex,"Reflex angle")

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ function isProperFraction(numerator, denominator) {
1111
if (Math.abs(numerator) < Math.abs(denominator)) {
1212
return true;
1313
}
14-
if (Math.abs(numerator) > Math.abs(denominator)) {
15-
return false;
16-
}
17-
if (Math.abs(numerator) === Math.abs(denominator) ){
14+
if (Math.abs(numerator) >= Math.abs(denominator)) {
1815
return false;
1916
}
17+
2018
if (isNaN(numerator)|| isNaN(denominator)) {
2119
return false;
2220
}

0 commit comments

Comments
 (0)