higher-order functions, partial application, function composition
javascript
Scenario Questions
0-2 years experience
1We have a simple function add(a, b) that returns a + b. How would you write a curried version so that add(2)(3) works?
2If you call your curried function with only the first argument and then later with the second, what does it return? Walk me through the steps.
3What happens if you pass three arguments to a curried version of a two‑parameter function?
2-5 years experience
1Our team refactored fetchData(url, options) to be curried, but some calls now throw 'undefined is not a function'. What could be causing this?
2Explain the trade‑offs between using a generic curry helper versus writing specific partially applied wrappers for each utility function.
3How would you adapt your curry implementation to handle functions with variable arity, like Math.max?
5-8 years experience
1Design a curry utility that can be used in a high‑throughput server handling thousands of requests per second. What performance considerations would you keep in mind?
2How would you ensure that your curried functions remain tree‑shakeable and don’t bloat the bundle size in a large front‑end app?
3When currying methods of a class, how do you preserve the correct this context?
8+ years experience
1Our organization is shifting toward a functional style. How would you plan the migration of existing utility functions to curried versions across multiple services while minimizing risk?
2What guidelines would you set for when to expose a function as curried in a shared library, considering maintainability and onboarding new engineers?
3If a legacy library’s custom curry implementation has memory‑leak issues, how would you decide between fixing it or replacing it, and what migration strategy would you propose?
Follow-up Questions
Can you show a quick example of using your curry with a two‑argument function?
What edge cases would you test for this implementation?
How would you modify it to preserve the original function's this binding?
Sharethis question
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.