Implement retry wrapper and interdependent validators
Company: Airbnb
Role: Software Engineer
Category: Other / Miscellaneous
Difficulty: hard
Interview Round: Onsite
Part A — Retry higher-order function: Implement wrapWithRetry(fn, options) for JavaScript/TypeScript functions that may throw or return a rejected Promise. Support policies: retry once, retry N times, and exponential backoff (configurable base, cap, optional jitter). Allow specifying retryable error types/conditions, per-attempt and overall timeouts, and cancellation via AbortController. Provide usage examples and discuss edge cases (synchronous throw vs asynchronous rejection, non-idempotent operations, retries outliving the caller, error propagation). Part B — Interdependent input validators: Build a component with three input fields and a validation framework where
(
1) one validator checks value length against configurable min/max, and
(
2) another validator errors when any two inputs have identical values. Changing one input must trigger revalidation of the others to keep cross-field constraints correct. Describe state management, composing per-field and cross-field validators, event triggers (onChange/onBlur), error display, accessibility, and performance considerations.
Quick Answer: This question evaluates a candidate's competence in building robust asynchronous utilities and form validation logic, covering retry/backoff strategies, error classification, per-attempt and overall timeouts, cancellation via AbortSignal, observable retry hooks, cross-field validators, state management, and accessibility considerations in JavaScript/TypeScript web applications. Category: Other / Miscellaneous; domain: web development and systems reliability in JavaScript/TypeScript; it is commonly asked because it probes both conceptual understanding of retry semantics, cancellation and validation constraints and practical implementation skills related to API ergonomics, error propagation, composable validators, and performance trade-offs.