Loan Eligibility Calculator

The Loan Eligibility Calculator is a simple and efficient tool designed to help you determine your basic eligibility for a loan. By entering key details such as age, income, employment status, credit score, and debt-to-income ratio, you can instantly assess whether you meet the requirements for a personal loan. This calculator provides an easy way to understand your financial standing and make informed decisions before applying for a loan.

function calculateLoanEligibility(income, expenses, loanAmount, interestRate) {
    if (isNaN(income) || isNaN(expenses) || isNaN(loanAmount) || isNaN(interestRate)) {
        return "Please provide valid numeric inputs for all fields.";
    }

    // Calculate disposable income
    const disposableIncome = income - expenses;

    // Maximum EMI that the user can afford (50% of disposable income)
    const maxEMI = disposableIncome * 0.5;

    // Loan calculation variables
    const monthlyRate = interestRate / 12 / 100; // Monthly interest rate
    const tenure = 60; // Loan tenure in months (5 years)

    // Calculate EMI using the formula
    const emi = (loanAmount * monthlyRate * Math.pow(1 + monthlyRate, tenure)) / 
                (Math.pow(1 + monthlyRate, tenure) - 1);

    // Eligibility check
    if (emi <= maxEMI) {
        return `Eligible: Your EMI is $${emi.toFixed(2)}, which is within your affordable limit of $${maxEMI.toFixed(2)}.`;
    } else {
        return `Not Eligible: Your EMI is $${emi.toFixed(2)}, which exceeds your affordable limit of $${maxEMI.toFixed(2)}.`;
    }
}

// Example usage
const income = 4000; // Monthly income in dollars
const expenses = 2000; // Monthly expenses in dollars
const loanAmount = 50000; // Desired loan amount
const interestRate = 7; // Interest rate in percentage

const result = calculateLoanEligibility(income, expenses, loanAmount, interestRate);
console.log(result);
Rate this post

Leave a Reply

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