Hi,
I hope you can help me with this. I’m trying to get the sum of all values after you click on the bottons. However, the loop is not adding the last value only. It’s taking the first value of the array, and then adding first and second value of the array when the function runs again.
Instead of doing 10 + 15 = 25, it’s doing 10 + 10 + 15 or 15 + 15 + 10.
Here’s the link to codepen: https://codepen.io/Polask1/pen/WNdGLEr?editors=0010