This question already has an answer here:
- Object comparison in JavaScript [duplicate] 10 answers
The code in question:
console.log(marker.getIcon() == selectedDestinationMarkerImage);
console.log(marker.getIcon());
console.log(selectedDestinationMarkerImage);
if(marker.getIcon() == selectedDestinationMarkerImage)
{
return true;
}
The console output
false
Object{url: "images/icons/dd-end.png", size: W}
Object{url: "images/icons/dd-end.png", size: W}
The icon on the marker is set to selectedDestinationMarkerImage at some point before this check. I would actually expect even the === comparison to return true. (I tried that as well, it doesn't)
Aucun commentaire:
Enregistrer un commentaire