← Back to If Statements
Question 254
Triangle Classifier
Triangle Classifier
The array triangles holds several triples of side lengths. For each triple, print one line in the forma b c: <verdict>(the three sides separated by spaces, then a colon). The verdict isNot a trianglewhen any side is not shorter than the sum of the other two, otherwiseEquilateral,IsoscelesorScaleneas 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
Sign in to use hintsTopics:
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.