title: Javascript variable message
body: <p>I have some code that creates a map and writes a variable to the console after a polygon has been created. I want to see the value of the variable length in the body of the page after the map. Can anyone please help? thanks. Here is a code snippet;</p>
  
  <pre><code>    //add event listener for completion of your polygon
                  google.maps.event.addListener(drawingManager, 'polygoncomplete', function(polygon) {
                      //get the coordinate array of your polygon
                      var path = polygon.getPath();
                      //calculate area
                      var area = google.maps.geometry.spherical.computeArea(path);
                      //calculate length
                      var length = google.maps.geometry.spherical.computeLength(path);
                      //print the area &amp; length
                      console.log('Polygon Area: ' +  area/1000000 + ' km sqs');
                      console.log('Polygon Length: ' +  length/1000 + ' kms');
  
                  });
  
                  //add event listener for completion of your polyline
                  google.maps.event.addListener(drawingManager, 'polylinecomplete', function(polyline) {
                      //get the coordinate array of your polyline
                      var path = polyline.getPath();
                      //calculate length
                      var length = google.maps.geometry.spherical.computeLength(path);
                      //print the length
                      console.log("Polyline Length: " +  length/1000 + " kms");
                  });
              }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="initMap()"&gt;
      &lt;b&gt;Calculating Length and Area&lt;/b&gt;&lt;br/&gt;
      &lt;div id="mapDiv"/&gt;
  &lt;/body&gt;
  </code></pre>