The problem with this

var a = {
    b: function () {
        console.log(this);
    }
};


var a = {
    b: () => {
        console.log(this);
    }
};


this
Mar.09,2021

this is the context of execution, and the arrow function does not have this , which means that the this you get here is actually the this point outside the arrow function, that is, the execution context of a .

Menu