Javascript anonymous function in settimeout function

Please refer to the below code. This code works correctly.

let user = { 
  firstName: "John", 
  sayHi() {   
  alert(`Hello, ${this.firstName}!`);  
 //using anonymous function 
  setTimeout(function() { 
  user.sayHi(); // Hello, John!
 }, 1000);

But when I code

setTimeout(user.sayHi, 1000); 

instead of anonymous function, it doen’t work(I know why. it’s because “this” of “this.firstName” loses its context ). But I can’t understand, why does it work when you use anonymous function?