Hey Everyone,
I am new to Javascript and have been banging my head against the wall for a few hours on this one. Below are the parameters of the problem and my current solution.
Parameters:
You put 1000 dollars into a new cryptocurrency. Good luck! Over ten years, the value of the investment increases by 5% each year. In the seventh year, the investment loses 75% instead of increasing. Eeek! Use a for loop to log how many years it has been and how much the investment is worth for each year.
Solution (so far):
let investment = 1000;
for (var year = 1; year <= 10; year++){
investment = investment + investment * 0.05;
console.log("In year " + year + " your investment was worth " + "$" + investment);
}
I have figured out how to increase the value of the investment by 5% each year, but I can’t figure out how to make it drop by 75% in year 7.
Please help point me in the right direction. Thank you for your help :).
-Buddha Blake