It is basically calling the create marker function to assign the name as a
title.

There are several ways of doing this, this is one of those.

Basically you declare marker .

You then declare marker as being equal to what you are doing in your
createMarker function.

In the createMarker function you are creating a new google.maps.Marker with
the options defined in the function.

Marker is now the resulting marker that was created in the createMarker
function.

That make sense?

On Thu, Jun 24, 2010 at 2:43 PM, 3D-kreativ <[email protected]> wrote:

> Hi!
>
> I found some code that I find useful, but I don't understand it 100%.
>
> var marker = createMarker(position,'Plats 1')
>
> Could someone tell me how this works? First is a declaration of the
> variable marker, the next part call a function with some value. But
> then, why this combination? whats the point? And in the function
> below, var marker is declared once again and is old value gone or? How
> does it work? Like to know what i'm doing! Thanks!
>
> // place markers
> var position = new google.maps.LatLng(56.8848, 14.7730);
> var marker = createMarker(position,'Plats 1')
>
> var position = new google.maps.LatLng(57.1719, 14.3701);
> var marker = createMarker(position,'Plats 2');
>
> function createMarker(latlng, name) {
>    var marker = new google.maps.Marker({
>        position: latlng,
>        map: map,
>        title: name
>        });
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to