Closures & Functions

Implement Custom Call and Apply

mediumJS SpecificJS / TS3 tests

Problem Statement

Implement `myCall(fn, context, ...args)` and `myApply(fn, context, argsArray)` without using native `Function.prototype.call` or `Function.prototype.apply`.

Examples

Example 1:
function sum(b) { return this.a + b; }
myCall(sum, { a: 10 }, 5); // 15
myApply(sum, { a: 10 }, [5]); // 15
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

3 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.