House Loan Approval Calculator (UK)
function calculateApproval() {
const loanAmount = parseFloat(document.getElementById(“loanAmount”).value);
const income = parseFloat(document.getElementById(“income”).value);
const creditScore = parseFloat(document.getElementById(“creditScore”).value);
const loanTerm = parseInt(document.getElementById(“loanTerm”).value);
const monthlyIncome = parseFloat(document.getElementById(“monthlyIncome”).value);
if (isNaN(loanAmount) || isNaN(income) || isNaN(creditScore) || isNaN(loanTerm) || isNaN(monthlyIncome)) {
alert(“Please fill in all fields with valid data.”);
return;
}
let approval = “Loan Approval Status: Pending”;
// Criteria for loan approval based on income and credit score
if (creditScore >= 650 && loanAmount = 1500) {
approval = “Loan Approved!”;
} else if (creditScore income * 5 || monthlyIncome < 1500) {
approval = "Loan Denied: Does not meet criteria.";
}
document.getElementById("approvalResult").innerHTML = approval;
}