value; var loanTerm = document.getElementById("loanTerm").value; var monthlyInterestRate = (interestRate / 100) / 12; var numberOfPayments = loanTerm * 12; var compoundedInterestRate = Math.pow((1 + monthlyInterestRate), numberOfPayments); var interestQuotient = (monthlyInterestRate * compoundedInterestRate) / (compoundedInterestRate - 1); var monthlyPayment = loanAmount * interestQuotient; document.getElementById("monthlyPayment").value = monthlyPayment.toFixed(2); document.getElementById("totalPayment").value = (monthlyPayment * numberOfPayments).toFixed(2); document.getElementById("totalInterest").value = ((monthlyPayment * numberOfPayments) - loanAmount).toFixed(2); } Loan Calculator Generator Loan Amount: php Copy code Interest Rate: Loan Term (in years): Calculate Monthly Payment: Total Payment: Total Interest: