<div>
<h1>函数科里化</h1>
</div>
<script>
// function add() {
// const args = Array.prototype.slice.call(arguments)
// const inner = function inner() {
// args.push(...arguments)
// return inner
// }
// inner.con = function() {
// let ttt = args.reduce((pre, cur) => {
// return pre+cur
// }, 0)
// console.log(ttt)
// }
// return inner
// }
const sub = (...args) => {
let value = args.sort((a, b) => {
return a - b
},0)
console.log(value)
}
function carring (func) {
let ast = []
return function result(...rest) {
if (rest.length === 0) {
func(...ast)
} else {
ast.push(...rest)
return result
}
}
}
carring(sub)(1,2)(7,5,6)()
// const receive = add(1,2,3)(4,5)(6,7,8,9,10)
// receive.con()
</script>