Line of Credit Interest Calculator
Calculate the interest cost of your line of credit at CIBC.
Calculation Results:
Interest Paid: $0.00
Total Repayment: $0.00
Time to Payoff: 0 months
function calculateInterest() {
let creditLimit = parseFloat(document.getElementById(“credit-limit”).value);
let outstandingBalance = parseFloat(document.getElementById(“outstanding-balance”).value);
let interestRate = parseFloat(document.getElementById(“interest-rate”).value) / 100;
let paymentAmount = parseFloat(document.getElementById(“payment-amount”).value);
if (isNaN(creditLimit) || isNaN(outstandingBalance) || isNaN(interestRate) || isNaN(paymentAmount) || creditLimit <= 0 || outstandingBalance <= 0 || interestRate <= 0 || paymentAmount 0) {
let interestThisMonth = outstandingBalance * interestRate;
outstandingBalance += interestThisMonth;
if (outstandingBalance < paymentAmount) {
totalRepayment += outstandingBalance;
break;
} else {
outstandingBalance -= paymentAmount;
totalRepayment += paymentAmount;
}
interestPaid += interestThisMonth;
monthsToPayoff++;
}
document.getElementById("interest-paid").textContent = "Interest Paid: $" + interestPaid.toFixed(2);
document.getElementById("total-repayment").textContent = "Total Repayment: $" + totalRepayment.toFixed(2);
document.getElementById("time-to-payoff").textContent = "Time to Payoff: " + monthsToPayoff + " months";
}