forked from netology-code/bjs-homeworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
28 lines (24 loc) · 1021 Bytes
/
main.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
function calculateTask1(){
let algebra = Number.parseInt(document.getElementById("algebra").value);
let geography = Number.parseInt(document.getElementById("geography").value);
let physics = Number.parseInt(document.getElementById("physics").value);
if(!algebra || !geography || !physics){
alert("Введите валидные значения");
return;
}
let taskResult = averageMark(algebra, geography, physics);
document.getElementById("task1Result").innerText = `Средняя оценка равна: ${taskResult}`;
}
function calculateTask2(){
let userName = document.getElementById("username").value;
if(!userName){
alert("Введите имя пользователя");
return;
}
let taskResult = sayHello(userName);
document.getElementById("task2Result").innerText = taskResult;
}
function calculateTask3(){
let taskResult = calculateFormula();
document.getElementById("task3Result").innerText = taskResult;
}