Implement numberOfArguments(...) — a function that returns how many arguments were actually handed to it at the moment it was called, regardless of how its parameters were declared. This is the call-time argument count, and it is a different thing from a function's declared arity (the number of named parameters you wrote, available as fn.length). A function can declare three parameters and be called with none, or declare none and be called with ten — this question is about counting what came in, not what was named.
// Accepts any number of arguments of any type.
// Returns the count of arguments passed at the call site.
function numberOfArguments(...args: unknown[]): number;
numberOfArguments(); // → 0
numberOfArguments(1, 2, 3); // → 3
numberOfArguments('a'); // → 1
// A passed undefined still counts — it filled an argument slot.
numberOfArguments(undefined); // → 1
numberOfArguments(null); // → 1
numberOfArguments(...[1, 2, 3]); // → 3 (spread fills three slots)
undefined counts. numberOfArguments(undefined) passes one argument that happens to be undefined. The result is 1, not 0 — the slot was filled.null counts too. Same reasoning: null is a value that occupies an argument slot.numberOfArguments(...[1, 2, 3]) is identical to numberOfArguments(1, 2, 3) — three arguments.fn.length. fn.length reports declared arity fixed at definition time; this question asks for the count at call time, which varies per call.