user={}
user.name="张 S."
function sayHi() {
alert("hi " + this.name );
}
//function func(){alert(this.name)}
let func = () => alert("hello " + this.name)
user.f=sayHi
user.f() //hi 张 S.
user.ff= func
user.ff() //为什么这里获取不了 this.name?
user.name="张 S."
function sayHi() {
alert("hi " + this.name );
}
//function func(){alert(this.name)}
let func = () => alert("hello " + this.name)
user.f=sayHi
user.f() //hi 张 S.
user.ff= func
user.ff() //为什么这里获取不了 this.name?
