this in javascript is the confusion of a lot of javascript devs which is evident since it's not uncommon to see that = this or self = this (my personal favorite when I just started learning javascript.
Personally I think a really expressive keyword instead would of been invocationContext but that would be ugly to have everywhere so I would settle for context or ctx
this
in javascript is the confusion of a lot of javascript devs which is evident since it's not uncommon to seethat = this
orself = this (my personal favorite when I just started learning javascript
.Personally I think a really expressive keyword instead would of been
invocationContext
but that would be ugly to have everywhere so I would settle forcontext
orctx
that = this
is actually generally used for referencing athis
in another scope.It creates really annoying code to read. But it's useful, here's an example off of stack overflow.
stackoverflow.com/questions/163611...
An object comparison methods like equals(...), I use if (this.equals(that)) and it seems quite readable.
Self.equals(other) doesn't sound as good to my ears