joseph

Finished
88 * @param {...number} sides
99 */
1010 constructor(...sides) {
11 throw new Error('Remove this line and implement the function');
11 // Edge Case: Invalid number of sides (not exactly 3)
12 if (sides.length !== 3) {
13 this.sides = [];
14 return;
15 }
16
17 this.sides = sides;
1218 }
1319
1420 /**
1521 * @returns {boolean}
1622 */
1723 get isEquilateral() {
18 throw new Error('Remove this line and implement the function');
24 // Edge Case: Not enough sides to form a triangle
25 if (this.sides.length !== 3) {
26 return false;
27 }
28
29 const [a, b, c] = this.sides;
30
31 // Edge Case: All sides must be positive
32 if (a <= 0 || b <= 0 || c <= 0) {
33 return false;
34 }
35
36 // Edge Case: Triangle inequality must hold
37 if (a + b < c || b + c < a || a + c < b) {
38 return false;
39 }
40
41 return a === b && b === c;
42 // Handled Edge Cases: Invalid number of sides, non-positive sides, triangle inequality violation
1943 }
2044
2145 /**
2246 * @returns {boolean}
2347 */
2448 get isIsosceles() {
25 throw new Error('Remove this line and implement the function');
49 // Edge Case: Not enough sides to form a triangle
50 if (this.sides.length !== 3) {
51 return false;
52 }
53
54 const [a, b, c] = this.sides;
55
56 // Edge Case: All sides must be positive
57 if (a <= 0 || b <= 0 || c <= 0) {
58 return false;
59 }
60
61 // Edge Case: Triangle inequality must hold
62 if (a + b < c || b + c < a || a + c < b) {
63 return false;
64 }
65
66 return a === b || b === c || a === c;
67 // Handled Edge Cases: Invalid number of sides, non-positive sides, triangle inequality violation
2668 }
2769
2870 /**
2971 * @returns {boolean}
3072 */
3173 get isScalene() {
32 throw new Error('Remove this line and implement the function');
74 // Edge Case: Not enough sides to form a triangle
75 if (this.sides.length !== 3) {
76 return false;
77 }
78
79 const [a, b, c] = this.sides;
80
81 // Edge Case: All sides must be positive
82 if (a <= 0 || b <= 0 || c <= 0) {
83 return false;
84 }
85
86 // Edge Case: Triangle inequality must hold
87 if (a + b < c || b + c < a || a + c < b) {
88 return false;
89 }
90
91 return a !== b && b !== c && a !== c;
92 // Handled Edge Cases: Invalid number of sides, non-positive sides, triangle inequality violation
3393 }
3494}
Test NameStatus
all sides are equal
Pass
any side is unequal
Pass
no sides are equal
Pass
all zero sides is not a triangle
Pass
sides may be floats
Pass
last two sides are equal
Pass
first two sides are equal
Pass
first and last sides are equal
Pass
equilateral triangles are also isosceles
Pass
no sides are equal
Pass
first triangle inequality violation
Pass
second triangle inequality violation
Pass
third triangle inequality violation
Pass
sides may be floats
Pass
no sides are equal
Pass
all sides are equal
Pass
first and second sides are equal
Pass
first and third sides are equal
Pass
second and third sides are equal
Pass
may not violate triangle inequality
Pass
sides may be floats
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.