I'm trying to create a JavaScript version of this equation that I got working in Excel:
Excel version:
10000*(1+0.06)^30+6000*(((1+0.06)^30-1)/0.06)
This calculates out to 531784.029
JavaScript version:
console.log(10000*(1+0.06)^30+6000*(((1+0.06)^30-1)/0.06));
Returns: 2789622
Or if I try to use Math.pow()
:
console.log(10000*(Math.pow(1+.06),30)+6000*(Math.pow((1+.06),30-1)/.06));
Returns: 841838.7898974773
I'm completely stumped after about 6 hours. How do I recreate that excel calculation and get the same number?