title: Convert an array to an "array of associative arrays" in jQuery
body: <p>I'm trying to do another silly thing in jQuery...</p>
  
  <p>I have a bunch of strings in an array:</p>
  
  <p><code>[ var1 , var2 , var3 , var4 , var5 , var6 , var7 , ...]</code></p>
  
  <p>And I want the array to become an "array of associative arrays", with the same index every time... (don't ask me why xD):</p>
  
  <p><code>[ { 'variable' : var1 } , { 'variable' : var2 } , { 'variable' : var3 } , ... ]</code></p>
  
  <p>The index 'variable' is the same every time.</p>
  
  <p>How does one do this? My attempt (below) isn't working... </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var stringarray = ['var1', 'var2', 'var3', 'var4'];
  var assarray = {};
  
  $.each(stringarray, function(index, value) {
  
    assarray[index] = {
      'variable': value
    };
  
  });
  document.write(JSON.stringify(assarray))</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>