Code javascript pour calculer l'intérêt composé

A self invoking function that can calculate compound interests

(function calc(){
  // p is principal amount
  let p=100000;
  // t is time
  let t=16;
  // r is interest rate
  let r=7.6
  // x is the final interest 
  let x=p;
  for(let i=1;i<t;i++){
    if(i==1){
      x*=(1+r/100);
    }
    x=(p+x)*(1+r/100);
  }
  console.log(x)
})()
Funny Fox