function memorize(fn) {
var cache = {};
return function() {
var k = [].join.call(arguments, ',');
return cache[k] = cache[k] || fn.apply(this, arguments);
}
}
function memorize(fn) {
var cache = {};
return function() {
var k = [].join.call(arguments, ',');
return cache[k] = cache[k] || fn.apply(this, arguments);
}
}
本文标题:函数记忆
本文链接:https://www.haomeiwen.com/subject/fbhncrtx.html
网友评论