0

What is the purpose of e in this function parameter ? Please help.

I should be able to use clientX directly instead of e.clientX shouldn't I ? --here is the code -- document.addEventListener("mousemove",function(e){ console.log(e.clientX); });

22nd Jul 2020, 10:37 AM
Serious Sam
Serious Sam - avatar
5 Respuestas
+ 2
The parameter (e) is automatically passed from javascript to you function when you add an event listener. It represents the element that was affected, an example would be the button element that was clicked
22nd Jul 2020, 10:46 AM
Aayush $aini
Aayush $aini - avatar
0
I don't understand
22nd Jul 2020, 10:56 AM
Serious Sam
Serious Sam - avatar
0
I didn't declare e...it should be working without parameter
22nd Jul 2020, 10:57 AM
Serious Sam
Serious Sam - avatar
0
Thanks for helping
22nd Jul 2020, 6:07 PM
Serious Sam
Serious Sam - avatar