is the first time that I use OOP in Javascript, called markerPlaces that have some data in it:
I want to access to the property lat for each node via for statement: I tried:
for(i=0;i<markerPlaces.length;i++){
console.log(markerPlaces[i][lat]);
}
But it doesn't work. The error is "lat is undefined".
The complete function is:
function initialize(markerPlaces) {
(function(window, google, maplib){
var mapOptions = maplib.MAP_OPTIONS,
domElement = document.getElementById('map'),
//map declaration
map = new google.maps.Map(domElement, mapOptions);
console.log(markerPlaces);
//for statement for markers
for(i=0;i<markerPlaces.length;i++){
console.log(markerPlaces[0].posts.lat);
}
markers = new google.maps.Marker({
position: {
lat:45.0690246,
lng:7.6932346
},
map: map,
icon: 'http://example.com/wp-content/themes/turisti/img/poi.png'
})
}(window, google, window.maplib || (window.maplib = {})));
}
but firebug result is: