title: Push lat/long coordinates to an array for Google maps
body: <p>I am trying to generate map markers for a Google map based off data attributes of a set of divs. I need the array to end up looking like this:</p>
  
  <pre><code>var markers = [
      [51.503454,-0.119562],
      [51.499633,-0.124755]
  ];
  </code></pre>
  
  <p>Here's what I have tried so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var markers = [];
  
  $(function() {
    $('.location').each(function() {
      var lat = $(this).attr('data-lat'),
          lng = $(this).attr('data-lng');
          
      markers.push(lat,lng);
    });
    
    console.log(markers);
  });</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;
  &lt;div class="location" data-lat="51.503454" data-lng="-0.119562"&gt;&lt;/div&gt;
  &lt;div class="location" data-lat="51.499633" data-lng="-0.124755"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I get the lat/lng coordinates in pairs instead of 4 separate values?</p>