On May 30, 11:58 am, dadoomkd <[email protected]> wrote:

>             var friends = [[ name = 'Saso', lat = 41.119452,long =
> 20.804672, zorder = 0],
>                            [ name = 'jasna', lat =47.765169, long =
> 28.124571, zorder =1],
>                            [name = 'nikola',lat = 62.291633, long =
> 14.824574, zorder =2]];


Have you tried to alert certain contents this array?
I'd guess you'd always get the value undefined because the syntax
doesn't seem to be valid.

You can do this: (the friends array would contain three objects)

  var friends = [{ name: 'Saso', lat: 41.119452, long: 20.804672,
zorder: 0 },
    { name: 'jasna', lat: 47.765169, long: 28.124571, zorder: 1 },
    { name:'nikola', lat: 62.291633, long: 14.824574, zorder: 2 }];

And the elements could be accessed for example in this way
alert(friends[0].name);


You can also do this: (the friends array would contain three further
arrays)

  var friends = [[ 'Saso', 41.119452, 20.804672, 0 ],
    [ 'jasna', 47.765169, 28.124571, 1 ],
    [ 'nikola', 62.291633, 14.824574, 2 ]];

And the elements could be accessed for example in this way
alert(friends[0][0]);


You can also do it a bit more tricky like this:

var friends = { 'Saso': { lat: 41.119452, long: 20.804672, zorder:
0 },
    'jasna': { lat: 47.765169, long: 28.124571, zorder: 1 },
    'nikola': { lat: 62.291633, long: 14.824574, zorder: 2 }
 };

And the elements could be accessed for example in this way
alert(friends.nikola.lat);

However, in any case you have to use valid syntax.


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