Skip to content

Commit 5c0dd07

Browse files
committed
Parse input values as numbers
1 parent a69a598 commit 5c0dd07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const tipPercentInput = document.getElementById("tip-percent");
33
const calculateButton = document.getElementById("calculate");
44
const outputText = document.getElementById("output");
55
calculateButton.addEventListener("click", () => {
6-
let amount = amountInput.value;
7-
let tipPercent = tipPercentInput.value;
6+
let amount = parseFloat(amountInput.value);
7+
let tipPercent = parseFloat(tipPercentInput.value);
88
let totalAmount = amount * (1 + tipPercent / 100);
99
outputText.innerText = `Total Amount: ${totalAmount.toFixed(2)}`;
1010
});

0 commit comments

Comments
 (0)