Example 1
const obj = {
perimeter: () => {
console.log(this); // this points to window
}
}
obj.perimeter()
const obj = {
sing(){
console.log(this);
const b = () =>{
console.log(this); // this points to obj
}
b();
}
}
obj.sing()
Arrow function this points lexical scope why the first output is different?
Arrow function this points lexical scope why the first output is different?