title: Javascript - adding random numbers generated in for loop
body: <p>I'm trying to find the sum of all variables, <code>dieRoll</code> outputted in for loop after the images are displayed. Thanks in advance.</p>
  
  <pre><code>    var out = '';
          for(var i = 0; i &lt; userSelect; i++){
              dieRoll = Math.floor((Math.random() * 6) + 1);
              out += "&lt;img src=\"_images/die" + dieRoll + ".jpg\"&gt;";
         }
      return out;
  </code></pre>