SOURCE

let momerizee =function(fn){
    let cache ={}
    return function(){
        let key = Array.prototype.join.call(arguments, "|")
        if(key in cache){
            return cache[key]   
        }
        console.log('--------------')
        return cache[key] = fn.apply(this,arguments)
    }
}



function add(a,b){
    return a+b
}


let momerizeeAdd = momerizee(add)

console.log(momerizeeAdd(1,2))

console.log(momerizeeAdd(1,2))

console.log(momerizeeAdd(1,2))
console 命令行工具 X clear

                    
>
console