Do you use 'this' in front of instance variables?

前端 未结 17 2138
猫巷女王i
猫巷女王i 2020-12-19 01:08

When accessing instance variables or properties of a class from within the class itself, do you prepend them with \"this.\"?

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 01:50

    Yes, if I see this. I'm sure it is local and I do not need to look any further. If it isn't prefixed with this. (or maybe '_') I have to check if it is declared locally or in an ancestor or if it's a parameter or ...

    All these checks take a little more time during debugging...

提交回复
热议问题