我的 javascript 输出与预期输出不匹配。我不知道我哪里错了

My javascript output does not match the expected output. I don't know where I went wrong

Write a program that predicts the approximate size of a population of organisms. Use the following data:

  • Starting number of organisms: 2
  • Average daily increase: 30%
  • Number of days to multiply: 10

The program should display the following table of data:

Day              Approiximate Population
1                                   2

2                                   2.6

3                                   3.38

4                                   4.39

5                                   5.71

6                                   7.42

7                                   9.65

8                                   12.54

9                                   16.31

10                                 21.20

我的代码没有输出相同的大概人口。我哪里做错了? 这是我的代码:

    var NumOfOrganisms = 2;
    var DailyIncrease = .30; 
    var NumOfDays;

    for(NumOfDays = 1; NumOfDays <= 10; NumOfDays++){
        calculation(NumOfOrganisms, DailyIncrease, NumOfDays);
    }

    function calculation(organisms, increase, days){
        var calculation = (organisms * increase) + days;
        console.log("increase is " + calculation);
    }

计算不应该等于生物体+(生物体*增加)吗?然后,如果您保持 运行 总数,则无需为函数提供天数

你没有考虑到不断变化的人口。

var NumOfOrganisms = 2;
var DailyIncrease = .30;
var NumOfDays;

console.log('initial population', NumOfOrganisms);

for(NumOfDays = 2; NumOfDays <= 10; NumOfDays++) {
  NumOfOrganisms = (NumOfOrganisms * DailyIncrease) + NumOfOrganisms;
  console.log('increase is', NumOfOrganisms);
}