function addAll(a,b,c) {
return a + b + c;
}
function divide10(x) {
return x / 10;
}
function normalize(x) {
return x * 5;
}
function composeWithArgs ( ...fns ) {
return function(...args) {
return fns.reduceRight( (f, g) => (() => g(f(...args)))());
}
}
composeWithArgs(normallize,divide10,addAll)(50,50,50); // f is not function
// А эта функция работает правильно
function composeWithArgs ( ...fns ) {
return fns.reduceRight( (f, g) => (...args) => g(f(...args)));
}
composeWithArgs(normallize,divide10,addAll)(50,50,50); // 75