0
Why is function window obj?
i put arrow function inside addeventlistener function, and this function output in console THIS (window obj). In function (check), THIS was missed and passed to function's addeventlistener and output in console window obj but not htmlDiv obj. Why? https://code.sololearn.com/WSlLl3MnBA6f/?ref=app https://code.sololearn.com/WSlLl3MnBA6f/?ref=app
2 Respuestas
+ 1
Arrow functions by default have a different behavior when using "this".
The easiest fix would be to use normal functions (Again, this is just the easy way, I believe there are ways to bind "this" to a certain object.
0
Arrow function,passed this to prev function THIS, but this doesn't work if the arrow or common function create not inside function, but beyond her