All challenges
JavaScript challenge· Frontend

Compose

easy
15m
#frontend#javascript#typescript#functions

Implement compose(...fns) that returns a function applying fns right to left: compose(f, g)(x) === f(g(x)). With no functions it is the identity.

compose(inc, double)(5) // => inc(double(5)) = 11