Javascript for Statement Calculate Compound Interest
let amount; // current amount of money let principal = 1000.0; // principal amount let rate = .05; // interest rate // output a table row for each year for ( let year = 1; year <= 10; ++year ) { amount = principal * Math.pow( 1.0 + rate, year ); console.log( year );//from w w w . j a v a 2 s .c om console.log( amount.toFixed(2) ); }