JSFiddle - React, Tailwind, and code Playground
by Czechler
JavaScript
var interestRate = 0.05; // or (5/100) this rate is annual
var numberofYear = 10;
var numberofPayment = numberofYear * 12;
var presentValue = 20000; //this is loan
function PMT(ir,np, pv, fv = 0){
var presentValueInterstFector = Math.pow((1 + ir), np);
var pmt = ir * pv * (presentValueInterstFector + fv)/(PresentValueInterstFector-1);
return pmt;
}
var testPMT = PMT(interestRate/12, numberofPayment, presentValue); //output
console.log(testPMT);