While there are some historical gotcha's when using this in certain contexts, if you plan to use JavaScript in an OOP sort of way, I would in no way say that you should steer away from using this. On top of that, constructors should not be defined with functions anymore. They should be in a class where using new is forced and the meaning of this is unambiguous.
Secondly I would greatly avoid using .bind or .call as much as you can. Some of the easiest ways to lose track of this is using functions in this way..
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.
While there are some historical gotcha's when using
this
in certain contexts, if you plan to use JavaScript in an OOP sort of way, I would in no way say that you should steer away from usingthis
. On top of that, constructors should not be defined with functions anymore. They should be in aclass
where usingnew
is forced and the meaning ofthis
is unambiguous.Secondly I would greatly avoid using
.bind
or.call
as much as you can. Some of the easiest ways to lose track ofthis
is using functions in this way..