Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Chase Lee
Chase Lee
29,275 Points

In the "mapOptions" object set the "center" key to a new google.maps namespaced "LatLng" object with the arguments of 28.42 and -81.58

Hey everyone,

I was doing the "Adding a Dynamic Map" in "Build an Interactive Website" and had problems with task 3 it told me to: "In the "mapOptions" object set the "center" key to a new google.maps namespaced "LatLng" object with the arguments of 28.42 and -81.58 ". Here is my code:

<!DOCTYPE html>
<html>
<head>
    <title>Map</title>
    <style type="text/css">
    body, html {
        margin:0;
        padding:0;
    }
    body, html, #map {
        width:100%;
        height:100%;
    }
    </style>
</head>
<body>
  <div id="map"></div>


    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAn8fk75K8kCdW6pQ4B7yoBHJNrUbleieY&sensor=false"></script>

 <script type="text/javascript">
        var mapOptions = {
        center: new google.maps.LatLng(-81.58, 28.42);
      };

        var mapElement;
        var theMap;
    </script>
</body>
</html>

Can anyone help! Thanks.

3 Answers

Chase Lee
Chase Lee
29,275 Points

I figured it out. I had to take out the semicolon at the end of:

center: new google.maps.LatLng(28.42, -81.58);

Thanks for your reply!

Elliott Frazier
PLUS
Elliott Frazier
Courses Plus Student 9,647 Points

it looks like you have the arguments reversed. you wrote:

        center: new google.maps.LatLng(-81.58, 28.42);

instead of:

        center: new google.maps.LatLng(28.42, -81.58);

hope this helps. :)

Chase Lee
Chase Lee
29,275 Points

I tried both ways but it still doesn't work.

try to remove the semicolon at the end of brackets ...

center: new google.maps.LatLng( 28.42, -81.58)

Should work !