Question: Write a JavaScript function to classify a triangle as equilateral ( all sides equal ) , isosceles ( any two sides equal ) or scalene
Write a JavaScript function to classify a triangle as equilateral all sides equal isosceles any two sides equal or scalene all sides different lengths To make the code clearer, you must use complex conditions. This function has been partially completed for you. Complete the complex conditions so that the appropriate classification is in the variable answer.
function classifyTriangle
Declare variables
var a b c answer;
Read inputs three sides
parseFloat documentgetElementById side value;
b parsefloat documentgetelementById side value;
parsefloat documentgetElementByIdside value;
Process find correct classification and put it in "answer"
Equilateral case first: COMPLETE
if
answer 'Equilateral';
Scalene case next: coMPLETE
else if
answer 'Scalene';
Everything left has to be Isosceles case:
else
answer 'Isosceles';
Display output
document.getElementById output innerHTML
'Classification 'tanswer;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
