2 ms·
Always name "this" and it will be easier to understand the context function Car() { var car = this; } And if it already have a name, use that name:
by z3t4 9y ago
Always name "this" and it will be easier to understand the context
function Car() {
var car = this;
}
And if it already have a name, use that name:
var foo = {
bar: 1,
say: function say() {
console.log(foo.bar); // foo instead of "this"
}
};