Skip to content

Commit 704130b

Browse files
committed
feat: added reseting of prev state
1 parent 5698abe commit 704130b

2 files changed

Lines changed: 11 additions & 115 deletions

File tree

Projects/bill tip calculator/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ function init() {
101101

102102
}
103103

104+
105+
// reset current state
106+
resetBtn.onclick = () => {
107+
numOfPeople = 1;
108+
tipPercentage = 0;
109+
billAmt = 0;
110+
billTotal.innerHTML = `$ 0.00`
111+
tipTotalPerPerson.innerHTML = `$ 0.00`
112+
billTipPerPerson.innerHTML = `$ 0.00`
113+
}
114+
104115
function calculateTip(billAmt, numberOfPeople, tipPercentage) {
105116
const tipAmt = (billAmt * (tipPercentage / 100))
106117
const tipAmtPerPeron = (tipAmt / numberOfPeople)

Projects/bill tip calculator/main.js

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)