I have a basic function here. I want to be able to pass parameters into it. However, it is being called by the addEventListener. Now, after reading on here and researching I got it to work so that if I put the TOP option in - it works. When I use the bottom option, just below it -it does not work. (Not if I want to use parameters). I just am wondering a basic explanation as to why the arrow function with a callback can take parameters, how is this going round exactly? Not sure I am explaining my question well.
for (i = 0; i < dots.length; i++) {
dots[i].addEventListener('click', (e) => imgChoose(e, i));
}
for (i = 0; i < dots.length; i++) {
dots[i].addEventListener('click', imgChoose);
}
var i = 0;
function imgChoose(e, i) {
var test = dots[i].className;
console.log(e);
}