Closures & Functions

Partial Application

mediumJS SpecificJS / TS3 tests

Problem Statement

Implement `partial(fn, ...presetArgs)`, which creates a function that invokes `fn` with `presetArgs` prepended to the arguments it receives.

Examples

Example 1:
const greet = (greeting, name) => `${greeting}, ${name}!`;
const sayHello = partial(greet, 'Hello');
sayHello('Alice'); // 'Hello, Alice!'
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.