I have following code
function delay(f, ms) {
return new Proxy(f, {
apply(target, thisArg, args) {
console.log(this)
console.log(thisArg)
setTimeout(() => f.apply(thisArg, args), ms)
}
})
}
function sayHi(user) {
alert(`Hello, ${user}!`);
}
sayHi = delay(sayHi, 3000);
let container = {
f: sayHi
}
container.f("Paul")
Why is this inside apply function equal to {apply: f} and not to the container object.
This is the object before dot, isn’t it?