Closures & Functions
Implement Unary Function Adapter
easyJS SpecificJS / TS3 tests
Problem Statement
Implement `unary(fn)`, which creates a function that accepts up to one argument, ignoring any additional arguments. This prevents common bugs like `['1', '2', '3'].map(parseInt)`.
Examples
Example 1: ['1', '2', '3'].map(unary(parseInt)); // [1, 2, 3] (instead of [1, NaN, NaN])
JavaScript & TypeScript starter code included
Run this as a live interviewPractice solo
3 test cases. No second person needed.