title: Javascript program help
body: <p>Update this program is supposed to keep track of the number of times each side is rolled not each roll itself.</p>
  
  <p>I am working on a javascript exercise that needs to take two dice, roll them 1000 times and keep track of each roll. I thought the best way to do it was to use an array but I am not exactly sure if I am going in the right direction with what I am doing. I just need a little help in pointing me in the right direction to get this to work because right now it doesnt output anything. Thanks here is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Exercise Five&lt;/title&gt;
  
  &lt;script type="text/javascript"&gt;
      function Die(){
          this.roll = function(){
              this.sides = 0;
              return parseInt((Math.random( ) * 1000) % this.sides) + 1;  
          }
      }
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
      var dieOne = new Die();
      var dieTwo = new Die();
      var rollOne = 0;
      var rollTwo = 0;
      var roll_value = new Array();
      var arrayPlace = 0;
  
      for(var i = 0; i &lt; 1000 ; i++){
          rollOne = dieOne.roll();
          dieOne.sides = 10;
          rollTwo = dieTwo.roll();
          dieTwo.sides = 10;
          arrayPlace = (rollOne + rollTwo) - 2;
          roll_value[arrayPlace]++;
      }
  
      for( var i = 0; i &lt; roll_value.length; i++){
          document.writeln(roll_value[i]);
      }
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>