title: add values to one variable with for loop totalSum Javascript
body: <p>I have some values that come randomized to an variable.
  Now i want to add every value to each other to get an total sum but the loop wont add them together. </p>
  
  <p>The index variable work when i console log it. but not the total sum of a current value and the index value.
  Any tips ?</p>
  
  <p>This is the loop
   // The indexValue is values I get from an array//</p>
  
  <pre><code>  var indexValue = index;  // Random number from 1 - 10
      var totalSum = 0;
  
     for(var x = 0; x &lt;indexValue; x++){
  
     var currentValue = index[x];
     totalSum += currentValue;
      }
  
      console.log(totalSum);
  </code></pre>