// Simple compound interest formula.
// Provide initial principal, annual rate (as percentage), number of compoundings over years.
// Remember to round appropriately for money.
function compoundInterest(principal, annualRate, compoundings, years) {
return principal * Math.pow(1 + ((annualRate / 100) / compoundings), compoundings * years);
}
Posted: March 20, 2023
Return to the snippets listing