What is the purpose of e in this function parameter ? Please help. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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
4 Respostas
+ 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