2629. Function Composition ¶ TypeScript 1 2 3 4 5 6 7type F = (x: number) => number; function compose(functions: F[]): F { return function (x) { return functions.reduceRight((val, f) => f(val), x); }; }