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 Customizing Google Maps Adding Info Windows

Steve Leichman
Steve Leichman
7,008 Points

Code Issues on Adding Info Windows Code Challenge

Just an FYI, there are some issues with the questions on this challenge

For the first task, you're asked to:

On line 27, set the variable "infoWindow" to a "new google.maps.InfoWindow" passing in an object with the key "content" set to the string of "Magic Kingdom"

In the second task, the direction is:

On the next line, in app.js, use "google.maps.event.addListener()" with "marker" as the first argument, "click" as the second, and then an anonymous function as the third.

When I attempted the task on line 18 I was told I was incorrect. When I attempted the task on line 28, it passed.

Just FYI if this is driving anyone nuts.

1 Answer

Emily Martinez
Emily Martinez
13,096 Points

Re: the second task

Yes, this was driving me crazy, but it makes sense.

google.maps.event.addListener(marker, "click", function(){});

If you try to run the code above on line 18, it fails because there is no global variable "marker" to pass to the addListener method. "marker" is declared on line 23 inside the anonymous function inside the .geocode() method, which means you can only access it locally (i.e. on line 28).

Hope that helps clarify things.