My problem is that I'm trying to remove an event listener on javascript. I had the listener as anonymous as I was passing parameters. The problem is that I have to remove the event listener from all the images later on in my code. I realize I need to re-write my code in order to give it an ID of some kind but I'm really struggling. Here is the part of my code that needs changing, any help will be great.
var images = document.getElementsByTagName("img");
for (var i = 0; i < 4; i++)
{
listenForI(i);
}
function listenForI(i)
{
images[i].addEventListener("click",function()
{
changeImage(i);
});
}