title: Pass JavaScript variable through URL
body: <p>I have a page that sets a few variables using javascript <code>Math.random()</code> as shown.</p>
  
  <pre><code>var RandomValue1 = Math.floor(Math.random() * 5);
  var RandomValue2 = Math.floor(Math.random() * 6);
  var string = array1[RandomValue1];
  var string = array2[RandomValue2];
  </code></pre>
  
  <p>I would like to allow a user to pass the <code>RandomValue</code> value through the <code>URL</code> to another person. When the second person goes to the shared <code>URL</code>, <code>RandomValue</code> is the value as the first person - so that the second person sees the same 'string' as the first person.</p>
  
  <p>I am fairly new to web design and web programming so I don't know if this needs to be handled on the server-side or client-side.</p>
  
  <p>I assume I need to pass a url something like <code>page1.html?RandomValue1=1&amp;RandomValue2=3</code> but I cannot get the page to then set those variables and load.  Can this be done in <code>JavaScript</code>?</p>