fn.call(thisArg, a, b) runs fn with this set to thisArg. It looks simple, and rebuilding it is a classic way to check that you know how this is really decided: by how a function is called. Doing it exactly right also means knowing what call does with null, undefined and primitives, which depends on whether the function is written in strict or sloppy code.
Add myCall to every function, in call.js. fn.myCall(thisArg, ...args) must behave like fn.call(thisArg, ...args), without using call, apply or bind.
Every function has a myCall method that does not appear in a for…in loop, with a length of 1 (like the built-in call).
It runs fn with every argument given and returns its result.
An object (including an array, a function or an object with no prototype) given as thisArg is this inside fn.
With null or undefined, a sloppy-mode function sees the global object as this; with undefined, a strict-mode function sees undefined.
With a primitive (a number, string, boolean, symbol or bigint), a strict-mode function sees the primitive itself; a sloppy-mode function sees it wrapped in its object (new Number(5) style).
No trace is left afterwards: while fn runs, this gains no string key and no enumerable property (Object.keys, for…in and JSON.stringify see nothing new); afterwards it keeps exactly its own keys (also when fn throws), its existing properties are untouched whatever their names, and no built-in prototype is left changed. A temporary non-enumerable symbol key may exist while fn runs, and reflection (Reflect.ownKeys, Object.getOwnPropertySymbols) can see it: without the built-ins, that cannot be avoided.
It works when fn calls myCall again, for built-in methods and for class methods; an arrow function keeps its own this.
Calling myCall on something that is not a function throws a TypeError.
It does not use Function.prototype.call, apply, bind, Reflect.apply or Reflect.construct.
Plain JavaScript in a browser page; call.js runs first, then the tests call myCall on functions they define in both strict and sloppy code.
The tests replace call, apply, bind, Reflect.apply and Reflect.construct with versions that report their use, for the moment myCall runs.
Out of scope: frozen or non-extensible objects, proxies, and a strict-mode function called with null (only the built-ins can make this exactly null; plain JavaScript can pass undefined at most).