-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (18 loc) · 712 Bytes
/
script.js
File metadata and controls
20 lines (18 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const angleA = document.querySelector("#anglea");
const angleB = document.querySelector("#angleb");
const angleC = document.querySelector("#anglec");
const output = document.querySelector("#output");
const checkButton = document.querySelector("#check");
checkButton.addEventListener('click', isTriangle)
function calculateSum(angle1, angle2, angle3){
const sumOfAngles = angle1 + angle2 + angle3;
return sumOfAngles;
}
function isTriangle(){
const sumOfAngles = calculateSum(Number(angleA.value),Number(angleB.value),Number(angleC.value))
if (sumOfAngles === 180){
output.innerText = "Yes, it can form a triangle";
}else {
output.innerText = "Could not form triangle!";
}
}