Description
Sometimes, functions aren’t organized in a simple list — they can exist deep inside nested objects.
In such cases, we might want to execute every function within the object (no matter how deeply nested) using the same parameters, and replace those functions with their results.
In this challenge, you’ll build a recursive evaluator that traverses an object and executes every function it contains.
Your Task
Implement a function Fn(obj) that returns a new function which:
- Accepts a variable number of parameters.
- Traverses the input object recursively.
- Executes all functions (at any nesting level) using the provided parameters.
- Returns an object with the same structure, but where functions are replaced with their computed results.
Example
Input
const obj = {
  a: {
    b: (a, b, c) => a + b + c,
    c: (a, b, c) => a + b - c,
  },
  d: (a, b, c) => a - b - c,
};
console.log(Fn(obj)(1, 1, 1));
Output
{
  a: { b: 3, c: 1 },
  d: -1
}
Explanation
- Every function in the object (including nested ones) is called with parameters (1, 1, 1).
- The returned object preserves the same structure, but all functions are replaced with their return values.
Expected Behavior
- Executes all functions recursively
- Supports deeply nested objects
- Returns the same structure with computed values
- Accepts multiple parameters
