12 ms·
Get rid of `this` in your JavaScript code
- thenerdfiles 13y agoAye, in AngularJS we often use var serviceInterface = {}; // a bunch of code for the service/factory/provider return serviceInterface; I personally think of services/factories/providers as "implementation details" which I group as "client-side services". "Services" in this phrase does not have the same meaning as "service" in Angularese, and this helps me think more clearly more often than not about how my code relates to my goal, so "serviceInterface" is really a shorthand for "clientsideServiceInterface".
- mcv 13y agoI read an article on Javascript, and suddenly I feel like I understand Lisp better. (No idea if Lisp actually works like this; I still don't actually understand it. Just, you know, feelings.) In any case, I like this. I've struggled with javascript's weird `this` scope in the past. And this also avoids the `new` operator, which I also feel doesn't really belong in javascript.