Created
April 27, 2020 01:17
-
-
Save dchenk/559c71e450e074408937142855f7b1bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// totalCostOverMonths returns the total cost of an amortizing loan given a fixed APR. | |
const totalCostOverMonths = ( | |
p, /* The principal borrowed */ | |
r, /* The APR / 1200 if APR is taken as a percentage; e.g., with APR of 9%, r = 9/1200 = 0.0075 */ | |
m /* The number of months the mortgage is held for; the number of payments */ | |
) => p * r * m / (1 - Math.pow(1 + r, -m)) - p; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment