title: How do I retrieve a random object from an array of objects ? Javascript
body: <p>I have this bit of code that adds an image to the 'imageContainer'</p>
  
  <pre><code>$('.imageContainer').prepend('&lt;img id="xboxLogo" src="images/xboxLogo.png"/&gt;')
  </code></pre>
  
  <p>I have this array of objects : </p>
  
  <pre><code>var imagesArray = { 
      xboxLogo : {
          id : 'xboxLogo';
          src: "images/xboxLogo.png";     
      },
      playStatLogo : {
          id : 'playStatLogo';
          src: "images/playStatLogo.png"; 
      },
      wiiLogo : {
          id : 'wiiLogo';
          src: "images/wiiLogo.png";  
      }
      }
  </code></pre>
  
  <p>What I want to do is have a function that I call which adds the image to the 'imageContainer' but I want the image to be randomly picked from the 'imagesArray'. How do i randomly get one of the 3 (xbox,playStation,wii) images and then retrieve their attributes so I can use them to create the images ? </p>