2021-01-17

//实现 multi(2)(3)(4)(5)()
const multiMaker = () => {
let arr = []
let multi = (...argu)=> {
if(argu.length>0) {
arr.push(...argu)
return multi
} else {
return arr.reduce((prev, cur)=>prev*cur)
}
}
return multi
}

const multi = multiMaker()
console.log(multi(2,3)(3)(4)(5)())

你可能感兴趣的:(2021-01-17)