title: Multiple arrays in loop structure
body: <p>I cannot think of a way to loop through two arrays at the same time. This code is for outputting a function's data to different divs on a page. <code>array1</code> defines the input and <code>array2</code> defines the output. </p>
  
  <p>How can I loop through the two arrays so that <code>item1</code> will always be paired with <code>'#div1'</code>, <code>item2</code> with <code>'#div2'</code>, etc.</p>
  
  <pre><code>var array1=[item1 , item2, item3, item4];
  var array2=['#div1', '#div2', '#div3', '#div4'];
  
  for (var i = 0; i &lt; array1.length; i++) {
  
      //code for to populate data goes here
  
      item.appendTo($(array2[i]));
  };
  </code></pre>
  
  <p>Am I at least correct in wrapping my function in a for loop?</p>
  
  <p>Thank you!</p>