Calculating future value with compound interest with JavaScript

后端 未结 6 1577
悲哀的现实
悲哀的现实 2021-02-04 19:39

I\'m trying to work on a script where the user inserts a monthly income and gets the future value with compound interest after 30 years. As it is now, I\'ve assigned some values

6条回答
  •  情话喂你
    2021-02-04 20:21

    Also I found with this alternative:

    function compoundInterest(principal, annual_rate, n_times, t_years) {
        return principal*(Math.pow(1 + annual_rate/n_times, n_times*t_years) - 1);
    }
    

提交回复
热议问题