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

Cristian Campos
Cristian Campos
5,727 Points

I dont understand whats the goal

Hi, i really dont understand the goal of this code challenge, in the task 2 of 3. the purpose 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."

I write the following code: google.maps.event.addListener(marker, "click", function(){});

and return the following error: Bummer! You need to call 'google.maps.event.addListener()' with 'marker', 'click' and an anonymous function.

what is the error?

2 Answers

Jacob Miller
Jacob Miller
12,466 Points

Your code should work. Are you calling it on the next line? Code should look like this:

infoWindow = new google.maps.InfoWindow({content: "Magic Kingdom"});
google.maps.event.addListener(marker, "click", function(){});
Cristian Campos
Cristian Campos
5,727 Points

yes, you're right. Tnx a lot!