Apology:
I apologize if this is a really basic question, I've looked around but since I never did get a very solid grounding in Javascript objects, I may be looking for answers in all the wrong places. That, and I don't have a solid enough grasp of Javascript to seperate out what is Javascript in all of the JQuery questions, and I don't want to use JQuery until I have a better understanding of Javascript in general. Thank you.
Problem:
I have a for loop that is going through an array of Google Map markers, to return them to active on the map I have open. The markers still exist somehow in the array because they return randomly when I iterate a couple times through this block of code. It will make it through one or two iterations of the loop, and then end. I added the hasOwnProperty test once I noticed the error, but this isn't skipping past the problem item in the array like I thought it should.
Question:
Why is my for loop skipping over objects in the array that I know are there?
//Code Loop
for (var i in removedMarkerArray)
{
//test for valid object
if (!removedMarkerArray[i].hasOwnProperty('title')) continue;
else alert("You dawg, this stuff passed.");
//the actual code doing real work, rather than testing.
if (removedMarkerArray[i].PD == PD)
{
removedMarkerArray[i].setMap(map);
placedMarkerArray.push(removedMarkerArray[i]);
removedMarkerArray.splice(i, 1);
}
}
//Example object in the array.
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: location.mouseover,
PD: location.PD
});
Thank you for reading through my question, and I'm looking forward to any answers.