Skip to content
Advertisement

calculate compound profit in javascript

I have to calculate compound profit.

for example, I have $100, increasing 10% monthly, and I have to calculate the total profit for 12 months. And I need a profit of every month in an array.

I have tried this

JavaScript

Advertisement

Answer

There seems to be a bit of missing info here, but if “profit” means the amount greater than the previous month:

Profit month over month:

JavaScript

Then, total profit:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement