UNPKG

compounding

Version:

calculates the value of the initial investment based on rates of return (daily, monthly, semi-annual, annual...).

8 lines (6 loc) 192 B
function investmentValue(invested, changes) { return changes.reduce(function(sum, i) { return sum * (1 + (i/100)); }, invested).toFixed(2) } module.exports = investmentValue;