compor JavaScript

//It is also called as nested function in ecmascript
const compose =(f,g) => (a) => f(g(a));
const sum = (num) => num + 1;
compose(sum,sum)(5)
//Answer is 7
Kumaran KM