/** * Mying */ function add() { let args = [...arguments] let fun = function () { // console.log(args,arguments) args.push(...arguments) return fun } fun.toString = function () { return args.reduce(function (a, b) { return a + b }) } return fun } sum = add(1,2)(3)(4)(5,6) console.log(sum)