方法是箭头函数:
let obj = {
name:"张三",
getName: ()=>{
console.log(this) // window
}
}
方法是function函数
let obj = {
name:"张三",
getName: function(){
console.log(this) // obj
}
}
方法是箭头函数:
let obj = {
name:"张三",
getName: ()=>{
console.log(this) // window
}
}
方法是function函数
let obj = {
name:"张三",
getName: function(){
console.log(this) // obj
}
}