title: How to build an array of Way Points dynamically using JavaScript?
body: <p>From a WebAPI I am getting the below array.</p>
  
  <pre><code>[
      {        
          "Latitude": "-38.080528",
          "Longitude": "144.363098"
      },
      {       
          "Latitude": "-38.080528",
          "Longitude": "144.363098"
      },
      {       
          "Latitude": "-37.844495",
          "Longitude": "144.873962"
      },
      {
          "Latitude": "-37.785911",
          "Longitude": "144.846497"
      },
      {
          "Latitude": "-37.720763",
          "Longitude": "144.978333"
      },
      {       
          "Latitude": "-37.777228",
          "Longitude": "144.95636"
      }
  ]
  </code></pre>
  
  <p>How can I construct an array of Way-Points in JavaScript using that at run-time.</p>
  
  <p>The expected output should match the below</p>
  
  <pre><code>var wayPointsArray = [
          {location: new google.maps.LatLng(-38.080528,144.363098) },
          {location: new google.maps.LatLng(-38.080528,144.363098) },
          {location: new google.maps.LatLng(-37.844495, 144.873962) },
          {location: new google.maps.LatLng(-37.785911, 144.846497) },
          {location: new google.maps.LatLng(-37.720763, 144.978333) },
          {location: new google.maps.LatLng(-37.777228, 144.95636) }
      ];
  
  console.log(wayPointsArray);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lczwq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lczwq.png" alt="enter image description here"></a></p>