DEV Community

Discussion on: Is `this` in Javascript bad?

Collapse
 
circleofconfusion profile image
Shane Knudsen

I'm generally avoiding the use of this in my code, but most of my code has been AngularJS, and we're very rarely using the object prototype in the first place. Rather than mix-in functions and inheritance, we're using factories and injecting them as dependencies into factories and controllers that depend upon them.

I do kind of have a pet peeve against const self = this; and have been removing it where I can. I feel like it's a symptom of Java developers that really really want to build a class.

That being said, I do sometimes wonder if I'm missing some cool use cases for this.