Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript code to calculate compound interest

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)
})()
Comment

PREVIOUS NEXT
Code Example
Javascript :: pass parameter to handleclick react 
Javascript :: react port 
Javascript :: anagram javascript example 
Javascript :: js convert string array to number array 
Javascript :: node sass version react 
Javascript :: shadowcolor liners in react native 
Javascript :: install stripe to react/nodejs - typescript 
Javascript :: add checkbox dynamically in javascript 
Javascript :: contains duplicate leetcode solution javascript 
Javascript :: discord.js checking channel permissions 
Javascript :: sequelize migration add column 
Javascript :: how to add number in string in javascript 
Javascript :: how to push items in array in javascript 
Javascript :: how to insert html into javascript 
Javascript :: how to remove the top border from table react bootstrap 
Javascript :: how to check if an element exists in an array of objects js 
Javascript :: fs.readfile 
Javascript :: return all trs in a table jqueyr 
Javascript :: axios patch 
Javascript :: add dark mode to react 
Javascript :: sort in mongoose aggregate lookup 
Javascript :: js split string every n characters 
Javascript :: status 502 bad api gateway error solution for aws lambda 
Javascript :: puppeteer set download path 
Javascript :: anchor link issue with fixed header css js 
Javascript :: remove duplicate value from string 
Javascript :: a.reduce 
Javascript :: rotate camera three js 
Javascript :: textarea javascript set value 
Javascript :: jquery chrome extension 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =