Hi Guys,
I’m working though Wes Bos’ Javascript 30, and I am on the “Playing with CSS Variables and JS” lesson, Im having a bit of trouble trying to figure out what a particular parameter/argument is referencing.
The parameter/argument is input highlighted below in the two examples:
// ES6 - Version
inputs.forEach(input => input.addEventListener(‘change’, handleUpdate));
//ES5 - Version
inputs.forEach(function(input) {
return input.addEventListener(‘Change’, handleUpdate);
});
If I change the name of these two for example from input to abc it still works, I assume it is not referencing the input tags in the HTML since I can change the name and it still works, I thought it might be the event object but Im a bit of a newbie so I cant understand why it would be the event object?
And if it is referencing the input I don’t understand what tells it to pull the input in?
Here is a JS Fiddle example:
https://jsfiddle.net/nv8L4b43/
Thanks Guys!