const compose = (...fns) => x => fns.reduceRight((v, f) => f(v), x);
const double = x => x * 2;
const add1 = x => x + 1;
const process = compose(add1, double);
process(3); // double runs first: 3*2+1 = 7compose() applies functions right-to-left β mathematical composition order.
A compose function is the traditional approach, applying functions right-to-left (mathematical notation).
Challenge: Implement a compose utility that takes multiple functions and returns a new function applying them right-to-left.