Closures & Functions

Implement Function.prototype.bind

mediumJS SpecificJS / TS3 tests

Problem Statement

Implement `myBind(fn, context, ...presetArgs)`, mimicking `Function.prototype.bind`. It must return a new function that binds `this` to `context` and prepends `presetArgs`.

Examples

Example 1:
function greet(punctuation) { return `Hello ${this.name}${punctuation}`; }
const bound = myBind(greet, { name: 'World' }, '!');
bound(); // 'Hello World!'
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.