-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
28 lines (14 loc) · 813 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let points = document.getElementById("points");
let averagePoints = document.getElementById("averagePoints");
let totalPoints = document.getElementById("totalPoints");
function calculates() {
let numberOne = Number(document.getElementById("num-1").value);
let numberTwo = Number(document.getElementById("num-2").value);
let numberhThree = Number(document.getElementById("num-3").value);
points.textContent = "Points:" + " " + numberOne + " - " + numberTwo + " - " + numberhThree;
// Our output with Math.floor is taken as an integer.
average = Math.floor((numberOne + numberTwo + numberhThree) / 3);
averagePoints.textContent = "Average Points:" + average;
total = (numberOne + numberTwo + numberhThree);
totalPoints.textContent = "Total Points:" + " " + total;
}