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: Geocoding

Hey everyone,

I was doing: Build an Interactive Website >Google Maps Integration >Adding Point Markers to a Map: Geocoding, and in task 1 they ask: 'In "app.js" on line 11 set "geocoder" to a new google.maps namespaced "Geocoder" object.'

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" src="app.js">
        geocoder = new google.maps.Geocoder();
    </script>
</body>
</html>

Thanks in advance!

Sorry, I'm not sure what your problem is? What are you having trouble with?

2 Answers

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

You should be putting your code in the app.js file not the script tag that links to app.js. Any code in a script tag that has it's src attribute set will not get evaluated.

Thanks Mr Chalkley! I would have never seen that.

Sorry I didn't specify correctly. The line that I'm having a problem with is:

geocoder = new google.maps.Geocoder();

That's the one I added, and here is what they give me as a hint: Bummer! You need to write the keyword 'new' followed by 'google.maps.Geocoder()'

Thanks.

sometimes the code challenge software gets buggy (esp. if you have multiple windows open and copy/paste answers in [versus typing].

Try starting the quiz over from the beginning.

I'v refreshed it multiple times but it still doesn't work.

Remember code challenges are case sensitive. That might be the problem.

I don't know where I've gone wrong...I went as far as to copy the code from the project files.:confused:

hmmmm....

I'll tag Andrew Chalkley. Maybe he can help.

you haven't specified var at the beginning. Also, is it written in app.js? it should be!