You are reading a single comment by @Joakim and its replies.
Click here to read the full conversation.
-
@Joakim Interesting... I remember I asked a question about .bind() in one of my other posts. I will have look more into .bind() .apply() and call()
Just to complicate things, the value of
this
actually depends on how the function is called.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
Which is why we have
.bind()
,.apply()
and.call()
. Learn to love those, while they feel a bit like a hack they're also very powerful :)Also worth reading to understand the flexibility of functions/objects:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions