Closures & Functions

Implement Pipe

easyJS SpecificJS / TS3 tests

Problem Statement

Implement `pipe(...fns)`, which composes functions from left to right. The result of each function is passed as the argument to the next.

Examples

Example 1:
const add1 = (x) => x + 1;
const double = (x) => x * 2;
const square = (x) => x * x;
const compute = pipe(add1, double, square);
compute(2); // ((2 + 1) * 2)^2 = 36
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.