forked from netology-code/bjs-homeworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
22 lines (20 loc) · 765 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
function calculateQuadraticEquation(){
let a = +window.a.value;
let b = +window.b.value;
let c = +window.c.value;
let result = getResult(a,b,c);
window.equation.textContent = `${a}*x^2 + (${b})*x + (${c}) = 0`;
let span = window.result;
span.textContent = "х = "+JSON.stringify(result);
}
function calculateAverageRating(){
let marks = window.marks.value.split("").map(Number).filter((n)=> !isNaN(n) && n > 0);
let averageMark = getAverageMark(marks);
window.averageMark.textContent = averageMark;
}
function calculateDrinkTask(){
let name = window.personName.value;
let dateOfBirthday = new Date(window.dateOfBirthday.value);
let drink = askDrink(name, dateOfBirthday);
window.drink.textContent = drink;
}