I need some help in creating an array of markers in Google Map so that it can be more efficient, instead of create a marker one by one. I tried the following but it doesn\'t
I see a few things:
1) in the for loop, var pointM... should just be pointM... adding the var makes it ignore the set you have outside the for loop.
2) you have a ; after a function that is breaking things.
Try this:
//create array to store a set of location
var collection = new Array();
//a set of locations stored in array
collection[0] = new google.maps.LatLng(13.742167701649997, 100.50721049308777);
collection[1] = new google.maps.LatLng(13.74428, 100.5404525);
collection[2] = new google.maps.LatLng(13.744108, 100.543098);
var pointMarkerImage = new Array();//store image of marker in array
var pointMarker = new Array();//store marker in array
//create number of markers based on collection.length
function setPoint(){
for(var i=0; i