Bank Islam House Loan Calculator

Bank Islam House Loan Calculator

Not calculated yet.

let loanSteps = “”; function calculateLoan() { loanSteps = “”; const loanAmount = parseFloat(document.getElementById(“loanAmount”).value); const loanTerm = parseFloat(document.getElementById(“loanTerm”).value); const interestRate = parseFloat(document.getElementById(“interestRate”).value) / 100; if (isNaN(loanAmount) || isNaN(loanTerm) || isNaN(interestRate) || loanAmount <= 0 || loanTerm <= 0 || interestRate <= 0) { alert("Please enter valid positive values for all fields."); return; } const monthlyInterestRate = interestRate / 12; const numberOfPayments = loanTerm * 12; const monthlyRepayment = (loanAmount * monthlyInterestRate) / (1 – Math.pow(1 + monthlyInterestRate, -numberOfPayments)); document.getElementById("monthlyRepayment").value = formatCurrency(monthlyRepayment); loanSteps += `Inputs:
Loan Amount: ${formatCurrency(loanAmount)}
Loan Term: ${loanTerm} years
Interest Rate: ${(interestRate * 100).toFixed(2)}%

`; loanSteps += `Formula:
Monthly Repayment = Loan Amount × Monthly Interest Rate / (1 – (1 + Monthly Interest Rate)-Number of Payments)

`; loanSteps += `Result:
Monthly Repayment: ${formatCurrency(monthlyRepayment)}
`; if (document.getElementById(“calculationStepsLoan”).style.display === “block”) { document.getElementById(“calculationStepsLoan”).innerHTML = loanSteps; } } function resetLoan() { document.querySelectorAll(“#bank-islam-house-loan-calculator input”).forEach(el => el.value = “”); loanSteps = “”; document.getElementById(“calculationStepsLoan”).innerHTML = “

Not calculated yet.

“; } function toggleLoanSteps() { const steps = document.getElementById(“calculationStepsLoan”); const arrow = document.getElementById(“toggleArrowLoan”); if (steps.style.display === “none” || steps.style.display === “”) { steps.style.display = “block”; arrow.style.transform = “rotate(180deg)”; steps.innerHTML = loanSteps || “

Not calculated yet.

“; } else { steps.style.display = “none”; arrow.style.transform = “rotate(0deg)”; } } function formatCurrency(n) { return “RM ” + n.toFixed(2); }

Leave a Reply

Your email address will not be published. Required fields are marked *