SOURCE

function add() {
    let args = [...arguments]
    function getData() {
        args.push(...arguments);
        return getData
    }
    getData.toString = function() {
        return args.reduce((a, b) => a + b)
    }
    return getData
}

console.log(add(1)(100, 2)(8))
console 命令行工具 X clear

                    
>
console