Closures & Functions

Predicate Negation Utility

easyJS SpecificJS / TS3 tests

Problem Statement

Implement `negate(predicate)`, which returns a function that negates the result of the given predicate function.

Examples

Example 1:
const isEven = (n) => n % 2 === 0;
const isOdd = negate(isEven);
[1, 2, 3, 4].filter(isOdd); // [1, 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.