I came across this problem when I was trying to optimize my code. I am trying to use a function in my code (seems like I have to repeat code 2 times to make it work, because I am not getting the result I want):

```js
let tmpCont = undefined;
let tmpPrice = undefined;

let evaluate = undefined;
let evaluate2 = undefined;

let cont = 0;
let tmp = true;

let cont2 = 30;
let tmp2 = false;

for (let i = 0; i < 10; i++) {
  evaluate = analize(cont, tmp);
  console.log(evaluate + "test");

  evaluate2 = analize(cont2, tmp2);
  console.log(evaluate2);
}

function analize(tmpCont, tmpPrice) {
  for (let i = 0; i < 10; i++) {
    tmpCont++;
  }
  return [tmpCont, tmpPrice];
}
```

Result I am getting (what I dont want):

```
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]
10,truetest
[ 30, false ]

```

My question is: Am I doing something wrong? I know why I am getting the result I dont want and I think something is missing **BUT do i have to repeat code to get the result below?**

Result I want:

```
10,truetest
[ 40, false ]
20,truetest
[ 50, false ]
30,truetest
[ 60, false ]
40,truetest
[ 70, false ]
50,truetest
[ 80, false ]
60,truetest
[ 90, false ]
70,truetest
[ 100, false ]
80,truetest
[ 110, false ]
90,truetest
[ 120, false ]
100,truetest
[ 130, false ]

```