I am trying to inherit the function context without binding it. Is that possible.
Look below
const test = {
prop: 42,
func: function() {
return this.prop;
},
};
const fn = test.func;
console.log(fn()) // this show undefined;
console.log(test.func()) // this show 42;
console.log(fn.bind(test)()) // this show 42, I dont like it though;
Why dose not fn
inherit the context?