Skip to content

Instantly share code, notes, and snippets.

@1FahadShakeel
Created August 2, 2022 06:30
Show Gist options
  • Save 1FahadShakeel/b1b7d605afc06e9f506604e9594e4712 to your computer and use it in GitHub Desktop.
Save 1FahadShakeel/b1b7d605afc06e9f506604e9594e4712 to your computer and use it in GitHub Desktop.
The Excel PMT Function in JavaScript
function pmt(rate, nper, pv) {
if (rate == 0) return -(pv) / nper;
var pvif = Math.pow(1 + rate, nper);
var PMT = rate / (pvif - 1) * -(pv * pvif);
return PMT;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment