You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function calculate(){let e=parseFloat(document.getElementById("s1").value),t=parseFloat(document.getElementById("s2").value),n=parseFloat(document.getElementById("s3").value);if(e>0&&t>0&&n>0){let a=(e+t+n)/2,s=Math.sqrt(a*(a-e)*(a-t)*(a-n));document.getElementById("answer").innerHTML="Area of a triangle with first side "+e+" units, second side "+t+" units, and third side "+n+" units and semi-perimeter "+a+" units is "+s.toFixed(2)+" unit²."}else document.getElementById("answer").innerHTML="Please enter a number greater than zero."}