### Please help me understand

I am having a hard time understanding why this works. It seems to me that I would be reset to 1 each pass of the loop. I knew this solution would work, but i dont understand why it does.

`function sumAll(arr) { `

var total = 0;

for (var i = Math.min(...arr); i <= Math.max(...arr); i++){ total += i; }

`return total;`

}

```
```sumAll([1, 4]);