title: Passing res.locals variable to GoggleMaps breaks initMap function
body: <p>I am having a problem with the Google Map initMap function. I am using Express and trying to pass an array of locations to make markers on the map. When I pass the variable set to the locations to the script in the view it breaks the initMap function and I get the error: initMap is not a function, calling to the deferred script that uses initMap as its callback. However, if I remove the locations variable, the map loads properly just without any markers. Here is my code:</p>
  
  <pre><code>&lt;script&gt;
          window.initMap = function() {
          var userLocation = {lat: 40.7410986, lng: -73.9888682};
          var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 16,
            center: userLocation
          });
            var locations = &lt;%=JSON.stringify(locations)%&gt;
            console.log(locations)
  
            var infowindow = new google.maps.InfoWindow();
            for(let i = 0; i &lt; locations.length; i++) {
              var marker = new google.maps.Marker({
              position: new google.maps.LatLng(locations[i][1], locations[i][2]),
              map: map
          });
            google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
              infowindow.setContent(locations[i][0]);
              infowindow.open(map, marker);
            }
          })(marker, i));
          }
        }
      &lt;/script&gt;
  </code></pre>
  
  <p>Thanks for the help. </p>