What does this mean?
Code: [Select]
I have a map with 3 markers set at loadtime. Then I have a function to calculate a route (so in the map 2 new markers are set, with a total of 5). I'm trying to remove the first 3 markers to leave just the route markers when route is calculated. I first pushed markers in an array with mkArray.push(marker);. Then the code above should remove the 3 initial markers.
The code does something, you can see it here (to test you can enter "Ostia" in input box). As you can see it removes the first marker when route is calculated. It's a starting point but I need to remove all markers except the 2 related to the route. :D
var i, j=mkArray.length-1;
// Keeping the first and last one
for(i=1;i<j;i++) {
mk=mkArray[i];
mk.setMap(null);
I have a map with 3 markers set at loadtime. Then I have a function to calculate a route (so in the map 2 new markers are set, with a total of 5). I'm trying to remove the first 3 markers to leave just the route markers when route is calculated. I first pushed markers in an array with mkArray.push(marker);. Then the code above should remove the 3 initial markers.
The code does something, you can see it here (to test you can enter "Ostia" in input box). As you can see it removes the first marker when route is calculated. It's a starting point but I need to remove all markers except the 2 related to the route. :D