The question about js this

function foo(){
  setTimeout(()=>{
    console.log("is:",this.id);//42
  },100)
}
var id = 21;
foo.call({id:42})
The this of the function in

js is dynamic, depending on who calls it at run time, in which the this inside
foo points to an anonymous object
setTimeout is called globally
arrow function without this points to the this
of setTimeout, so why not 21 print result is 42?
ask God for a detailed explanation?

Feb.27,2021

because you used the arrow function
can be simply understood as: there is no this, inside the arrow function. If this, is used internally, it will save the defined this as part of the execution environment, and the saved this will be used during execution.

if you change the arrow function to function, the result will be different

  introduction to ES6  

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-1b2c2ca-e041.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-1b2c2ca-e041.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?