Given this class
class Car {
foo() {
console.log(this)
}
bar = () => {
console.log(this)
}
baz = function() {
console.log(this)
}
}
let car = new Car();
let a = car.foo;
let b = car.bar;
let c = car.baz;
a() // undefined
b() // car object
c() // undefined
How come the property assigned arrow function binds the value of this
at it's declaration ?
I thought arrow functions use the this
value of the execution context, not declaration.