javascript函数库

//构造缓存函数
var memoizer = function (memo, fundamental) {
    var shell = function (n) {
        var result = memo[n];
        if (typeof result !== 'number') {
            result = fundamental(shell, n);
            memo[n] = result;
        }
        return result;
    };
    return shell;
};
原文地址:https://www.cnblogs.com/ghgyj/p/4005382.html