jeudi 22 octobre 2015

Javascript If statement - should be true, evaluating to false [duplicate]

This question already has an answer here:

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