transferring the "this" value to a function
Hey, i have a class with a function in that logs out a
this.
variable. When i call that function inside of a function outside of the class it works, however when i call that function as a callback, it can't find the this
value and i have to use .bind
(i'm sure call
and apply
could potentially be used too) to allow it to work, since the callback parameter has the function as the value, i don't understand what causes that error compared to straight up calling it.
i'd appreciate any help, thanks in advance.
https://codepen.io/deerCabin/pen/RNbQvbd4 Replies