61. create your own `Function.prototype.call`

JavaScript
Is this helpful ?

medium  - accepted / - tried

Function.prototype.call is very useful when we want to alter the this of a function.

Can you implement your own myCall, which returns the same result as Function.prototype.call?

For the newest ECMAScript spec, thisArg are not transformed. And not replaced with window in Strict Mode.

Your implementation should follow above spec and do what non Strict Mode does.

Function.prototype.cal/apply/bind and Reflect.apply should not be used.

Let's try to solve this problem within 10 minutes.

Discuss(25)