//将函数 fn 的执行上下文改为 obj 对象
// 输入:
// function () {return this.greeting + ', ' + this.name + '!!!';}, {greeting: 'Hello', name: 'Rebecca'}
// 复制
// 输出:
// Hello, Rebecca!!!
const fn = function () {return this.greeting + ', ' + this.name + '!!!';}
const obj = {greeting: 'Hello', name: 'Rebecca'}
function speak(fn, obj) {
return fn.apply(this,obj)
}
console.log(speak(fn, obj))