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 Build an Interactive Website Google Maps Integration Adding Point Markers to a Map: Markers

In app.js, on line 20, initialize a new marker with the 'map' set to 'theMap' and the 'position' set to 'addressLocation

Can anyone see why the code below does not work?

var marker = new google.maps.Marker({map: theMap, position: addressLocation});


Bummer! The marker wasn't initialized properly. Try using '{map: theMap, position: addressLocation}' in to a 'new google.maps.Marker'

3 Answers

I just passed it with this line:

var marker = new google.maps.Marker({map: theMap, position: addressLocation});

I can't see any difference between the two. Maybe try again in case the code challenge was having some problems.

Maybe try copying my code here and pasting that into the code challenge.

Hey thanks a lot! The problem, it turns out, was that I was creating this variable inside the script tag on the HTML as opposed to on the app.js file (very dumb mistake I know). In fact, there is nothing wrong with the code above!

That makes sense. Glad you figured it out.