Skip to content

Commit c748fd8

Browse files
committed
Add tip amount display
1 parent e0ede91 commit c748fd8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ calculateButton.addEventListener("click", () => {
77
let amount = parseFloat(amountInput.value); //get amount value
88
let tipPercent = parseFloat(tipPercentInput.value); //get tip percent value
99
let totalAmount = amount * (1 + tipPercent / 100); //get total billing amount
10-
outputText.innerText = `Total Amount: ${totalAmount.toFixed(2)}`; //set output text area to format total billing amount
10+
let tipAmount = amount * (tipPercent / 100); //get tip amount
11+
outputText.innerText = `Total Amount: ${totalAmount.toFixed(2)}\nTip Amount: ${tipAmount.toFixed(2)}`; //set output text area to format total billing amount and tip amount
1112
});

0 commit comments

Comments
 (0)