That's why below is a good programming practice to avoid that equality operator typo.
Code:
if (1 == myVar){
...
}
If in case you had
if (1 = myVar), it will throw a runtime error and immediately alerts the developer that there's something wrong in the code.
BTW, if you access the src of an image, it will give you the absolute path, so the code should check for occurrence of the filename and not equality.
Code:
if (whichMap.indexOf("images/500000.jpg") != -1) {
alert("Insert data here...");
}