It is only when call, bind and apply are used for the wrong reasons - or excessively - that this starts to get unpredictable. In my opinion this is the exact thing that makes Javascript as powerful as it is.
this always points to the context of the call to the function within which the keyword is used.
Arrow functions do what they do because the above statement does not apply to them. Instead, they inherit their this value from their declaration context.
That's all there is to it. It is never arbitrary, nor should it be difficult to determine, where this points to. I think it's just a matter of awareness of the fact that you'll have to look for its value at the preceding call stack, instead of it's lexical scope.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It is only when
call
,bind
andapply
are used for the wrong reasons - or excessively - thatthis
starts to get unpredictable. In my opinionthis
is the exact thing that makes Javascript as powerful as it is.this
always points to the context of the call to the function within which the keyword is used.Arrow functions do what they do because the above statement does not apply to them. Instead, they inherit their
this
value from their declaration context.That's all there is to it. It is never arbitrary, nor should it be difficult to determine, where
this
points to. I think it's just a matter of awareness of the fact that you'll have to look for its value at the preceding call stack, instead of it's lexical scope.