The pointing problem of Arrow function this

var o = {
    a:11,
    b: () => {
        console.log("this is", this);
    }
}

o.b();

clipboard.png

Why does this point to window?

Mar.10,2021
The this object in the body of the
 () => { }thisthis

arrow function () = >
function is the object in which it is defined, not the object in which it is used. The direction of the
this object is variable, but in the arrow function, it is fixed.


the arrow function this points to the superior, o defines that all this points to window


without the arrow function this refers to o this object, o actually the this in the window.o, arrow function will indicate that the outer this, is the this, under window, of course it is window.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b375e4-2c092.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b375e4-2c092.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?