How do I choose a random value from an array with JavaScript?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4550505/javascript-getting-random-value-from-an-array">JavaScript: Getting random value from an array</a>  </p>
</blockquote>



<p>I have an external js with the following line:</p>

<pre><code>var postmessage = "hi my favorite site is http://google.com";
</code></pre>

<p>but is there a way to pick a site a random from an array so like this</p>

<pre><code>var postmessage = "hi my favorite site is +'random'";

random= http://google.com, http://yahoo.com, http://msn.com, http://apple.com
</code></pre>

<p>how do i make it work?</p>
