function
calculateTrigFun() {
const angleInput = parseFloat(
document.getElementById(
"angleInput"
).value);
if
(isNaN(angleInput)) {
document.getElementById(
"output"
).innerText =
"Please enter a valid angle."
;
return
;
}
const angleInRadians = angleInput * (Math.PI / 180);
const sine = Math.sin(angleInRadians);
const cosine = Math.cos(angleInRadians);
const tangent = Math.tan(angleInRadians);
const outputText = `Sine: ${sine.toFixed(4)},
Cosine: ${cosine.toFixed(4)},
Tangent: ${tangent.toFixed(4)},
Cosecant: ${(1 / sine).toFixed(4)},
Secant: ${(1 / cosine).toFixed(4)},
Cotangent: ${(1 / tangent).toFixed(4)}`;
document.getElementById(
"output"
).innerText = outputText;
}