for(let i = 0; i <= todosToday.length - 1; i++) {
const a = document.createElement("a");
a.addEventListener("click", function() {
showFoundTodo(todosToday[i]);
});
}
This works for Chrome but not for IE, specifically IE11. The instance of the array todosToday on i does not get passed when I attach the function showFoundTodo in the click event.
function showFoundTodo(todo) {
console.log(todo);
}
This function prints out undefined thus making the argument unusable. On Chrome, it outputs to the object with no problems.
I checked and only in that instance does todosToday become unreadable. To zero in where the change occurse, every where else I'd do a console.log() and it prints out the object (before the for loop, inside, and after it). At first I thought it was the attachEvent compatibility but that was for earlier versions of IE and the function also gets called. Any help is greatly appreciated.