Im following this course and came across this problem
const compose = (f, g) => (a) => f(g(a));
const add1 = (num) => num + 1;
const add5 = (num) => num + 5;
compose(add1, add5)(10)
As i understand it g(a) gets run first so num = 1 makes 1 for g and 10 for a, that makes it f(1(10)).
But how does the 1 and the 10 know to add, why doesn't it multiply or minus ?
compose(add1, add5)(10)->a === 10,g === add5,f === add1->add1(add5(10))