-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
24 lines (19 loc) · 973 Bytes
/
app.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
const btn = document.querySelector('.stacked-bills');
function calculate(event) {
event.preventDefault();
let heightFeet = parseFloat(document.querySelector('.height-feet').value);
let heightInch = parseFloat(document.querySelector('.height-inches').value);
let billChoice = document.querySelector('.money').value;
const billThickness = .0043;
let heightConvert = (heightFeet * 12 + heightInch);
const numOfBills = Math.ceil(heightConvert / billThickness);
const heightWorth = Math.ceil(numOfBills * billChoice);
const answer = document.querySelector('.answer-field');
// answer.classList.add('answer');
answer.innerHTML = (`It would take ${numOfBills} $${billChoice} bills to be as tall as you! And that's a total of $ ${heightWorth}! Wish that was in my bank account!`);
console.log(answer.innerHTML);
setTimeout(() => {
answer.innerHTML = "";
}, 8000);
};
btn.addEventListener('click', calculate);