function carry(x) {
const num = x
return function func(...args) {
if(arguments.length >= 5) return num + args.reduce((acc, val) => acc + val, 0)
// return func(...args)
}
}
const sum5 = (...args) =>
args.length > 4
? args.slice(0, 5).reduce((acc, n) => acc + n, 0)
: sum5.bind(null, ...args);
// или
// : (...args2) => sum5(...args, ...args2);