title: Set div id's from array content
body: <p>I'm trying to figure out how to give 16 different divs the id names that are stored in a 16 elements long array.</p>
  
  <p>This is so that I can randomize the divs "placement" for a memory game, since there will be 8 different div styles that will change along with the div id if that is possible.</p>
  
  <p>My plan is to have the same name for the div id as for the style for that specific div.</p>
  
  <p>Is there any way to set the first div's id and style as the value in myarray[0], and the second div's id and style as myarray[1], and so on?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>var card = ["orange","orange","pink","pink","red","red","purple","purple",
  "blue","blue","green","green","brown","brown","yellow","yellow"];
  
  for(var j, x, i = card.length; i; j = parseInt(Math.random() * i),
  x = card[--i], card[i] = card[j], card[j] = x);
  </code></pre>
  
  <p>then later in the body I'm trying to achieve something that represents this:</p>
  
  <pre><code>&lt;div id="card[0]"&gt;&lt;/div&gt;
  &lt;div id="card[1]"&gt;&lt;/div&gt;
  &lt;div id="card[2]"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and so on...</p>