3 ms·
I prefer to use a variable name that describes the type of the object in short. So if my "this" object is actually an AwesomeTableWidget instance, I might do:
by pavlov 10y ago
I prefer to use a variable name that describes the type of the object in short.
So if my "this" object is actually an AwesomeTableWidget instance, I might do:
var table = this;
I like the bit of extra documentation it provides... Or maybe this is just a remnant of all the C code I've written over the years, where it's common to have an object pointer as the first argument to a function and it's usually named like this.
- lorenzosnap 10y agoyou are so much better off if you can avoid using this when writing js. It's as bad as (and as useless) the keyword 'new'
- lorenzosnap 10y agonegative votes here are totally unfair. I was pointing it out that the 'this' keyword is dangerous.
- timebomb 10y agoWhy is it dangerous?