JSFiddle - React, Tailwind, and code Playground

by wisegorilla

JavaScript

const interestRate = 6.78 / 100;
const loanAmmount = 3100;
const upfront = 0;
const terms = 240; //duration in months
const monthlyRate = interestRate/12;
const payment = (loanAmmount - upfront) * (monthlyRate/(1-Math.pow(1+monthlyRate, -terms)));
const totalPaid = (payment * terms);

console.log(payment);