Skip to content

Commit 59d668e

Browse files
committed
update js file
1 parent 301df47 commit 59d668e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Loan Calculator/script.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

2-
function calculateLoan(){
3-
const amount = document.querySelector("#amount").value;
4-
const interestRate = document.querySelector("#interest").value;
5-
const months = document.querySelector("#months").value;
2+
function calculateLoan() {
3+
const amount = document.querySelector("#amount").value;
4+
const interestRate = document.querySelector("#interest").value;
5+
const months = document.querySelector("#months").value;
66

7-
const monthlyRate = (interestRate)/(12*100);
8-
const onePlusR = Math.pow(1+monthlyRate, months);
9-
const den = onePlusR - 1;
7+
const monthlyRate = (interestRate) / (12 * 100);
8+
const onePlusR = Math.pow(1 + monthlyRate, months);
9+
const den = onePlusR - 1;
1010

11-
const emi = (amount * monthlyRate * (onePlusR/ den)).toFixed(2);
12-
const totalPay = (emi * months).toFixed(2);
11+
const emi = (amount * monthlyRate * (onePlusR / den)).toFixed(2);
12+
const totalPay = (emi * months).toFixed(2);
1313

14-
document.querySelector("#payment").innerHTML = `EMI: ₹ ${emi} <br><br> Total Payment: ₹${totalPay}`
14+
document.querySelector("#payment").innerHTML = `EMI: ₹ ${emi} <br><br> Total Payment: ₹${totalPay}`
1515

16-
}
16+
}

0 commit comments

Comments
 (0)