Mortgage Calculator

<script>
function calculateMortgage() {
    const loanAmount = document.getElementById("loanAmount").value;
    const interestRate = document.getElementById("interestRate").value;
    const loanTerm = document.getElementById("loanTerm").value;
    const monthlyRate = (interestRate / 100) / 12;
    const numPayments = loanTerm * 12;
    const monthlyPayment = (loanAmount * monthlyRate) / (1 - Math.pow((1 + monthlyRate), -numPayments));
    document.getElementById("monthlyPayment").textContent = "$" + monthlyPayment.toFixed(2);
}
</script>
Scroll to Top