CJCoding With Joseph
15free / daySign inCreate account

Triangle Classifier

The array triangles holds several triples of side lengths. For each triple, print one line in the form a b c: <verdict> (the three sides separated by spaces, then a colon). The verdict is Not a triangle when any side is not shorter than the sum of the other two, otherwise Equilateral, Isosceles or Scalene as usual. Use for...of with array destructuring to unpack each triple, and put the validity test first in the chain so the type tests only run for real triangles.

Expected Output:

3 4 5: Scalene
2 2 2: Equilateral
1 2 3: Not a triangle
5 5 8: Isosceles

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.