Skip to content

Instantly share code, notes, and snippets.

@timpamungkasudemy
Created February 17, 2024 00:06
Show Gist options
  • Save timpamungkasudemy/292cd95b4cc70d9581553a8fac1bbba9 to your computer and use it in GitHub Desktop.
Save timpamungkasudemy/292cd95b4cc70d9581553a8fac1bbba9 to your computer and use it in GitHub Desktop.
export function calculateMonthlyInstallment(loanAmount, tenureInMonths, annualInterestRate) {
let monthlyInterestRate = annualInterestRate / 12 / 100;
let monthlyPayment = loanAmount * monthlyInterestRate / (1 - Math.pow(1 + monthlyInterestRate, -tenureInMonths));
return Math.round(monthlyPayment * 100) / 100;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment