#3Where ‘this’ executes?

dengshicheng1996dengshicheng19962022/05/10

What will each output?

let name = 'global';
const obj = {
    name:'obj',
    test:function(){
        let name = 'scope';
        console.log(this.name);
    }
}
const test = obj.test;
test(); 
obj.test(); 
License Copyright © 2022-present lencx