4 ms·
To make it more clear, you can use names. For example: function Car() { const car = this; function foo() { car.engine = "v8"; // vs self.engin
by z3t4 10y ago
To make it more clear, you can use names. For example:
function Car() {
const car = this;
function foo() {
car.engine = "v8"; // vs self.engine
}
}
- nkkollaw 10y agoNot much clearer, if not less. var self = this; and var that = this; are the standard way and the intent is understood right away.