vue中体现缓存函数,用以下代码解释
function cached(fn){
const cache = Object.create(null)
return (function cachedFn(str){
const hit = cache[str]
return hit || (cache[str] = fn(str))
})
}
const capitable = cached(function(str){
return str.charAt(0).toUpperCase() + str.slice(1)
})
capitable(camplizedId)
curry柯里化
https://zhuanlan.zhihu.com/p/112505577
https://zhuanlan.zhihu.com/p/149587276
https://www.zhihu.com/question/394062839/answer/1496127786
https://blog.csdn.net/jhzhahuaiyu/article/details/83143591递归优化