Good day. I only understand with JavaScript , I try to write a simple squeak with conditions. But in fact, the conditions are read incorrectly - with any input data, the script gives the result of the last condition (('1 (Scalene)') . Help me figure out where I have an error! Thank you!
function displayResult() { var a = document.getElementById('a').value; var b = document.getElementById('b').value; var c = document.getElementById('c').value; document.getElementById('result').innerHTML = calculateResult(a, b, c); } function calculateResult() { if (a == b && b == c) { return ('3 (Equilateral)') } else if (a >= (b + c) || c >= (b + a) || b >= (a + c)) { return ('4 (Error. Not a triangle)') } else if ((a == b && b != c) || (a != b && c == a) || (c == b && c != a)) { return ('2 (Isosceles)') } else if (a != b && b != c && c != a) { return ('1 (Scalene)') } } <input type="text" name="a" id="a" placeholder="Side a"> <input type="text" name="b" id="b" placeholder="Side b"> <input type="text" name="c" id="c" placeholder="Side c"> <input type="button" id="calculate" onclick="displayResult()" value="Triangle type"> <br> <p id="result"></p>