Watching video tutorial on switch functions. And there the author gave an example:
let person = { name: "Bob", greet: function() { setTimeout(() => { console.log('Hello, my name is ' + this.name); console.log('this is', this); }, 2000); } }; But, as a person working with javascript for some time, I know that this in the body of setTimeout refers to setTimeout and in this example this problem is solved using the arrow function, but why then this in this case refers to the person object, and not on greet: function() ? And how is it most effective to remember when and what this refers to?