Closures & Functions

Flip Function Arguments

easyJS SpecificJS / TS3 tests

Problem Statement

Implement `flip(fn)` that creates a function that invokes `fn` with its first two arguments reversed.

Examples

Example 1:
const subtract = (a, b) => a - b;
const flipped = flip(subtract);
flipped(2, 5); // 5 - 2 = 3
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.