Calculating future value with compound interest with JavaScript

后端 未结 6 1564
悲哀的现实
悲哀的现实 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:07

    This will work for any case, note that period has a benchmark of 1 of a year so for instance every 6 months period = 2, 4 months period = 3 etc...

    var init = 500000
    var years = 30
    var compound = 1
    var interest = 3.99
    var period= 2
    var total = 0
    
    
    
    function CInterest(){
        for(let i=0; i

提交回复
热议问题